Proper alignment of content in HTML using Bootstrap following the integration of .json data

After aligning the emergency hotlines properly, I am struggling to position the text under the image to display the data in three rows. I attempted col-4 but encountered issues with JSON. My objective is to show the image followed by the numbers directly below it. I have tried using text-align, float, display, and media queries without success. Any assistance on this matter would be greatly appreciated. Thank you.

The current scenario is as follows:

Click here for an image description

UPDATE: A JSfiddle of the question has been provided, placeholders are used to indicate positioning. Follow this link to access the JSfiddle

<div class="module-text" ng-controller="VolunteerAidCtrl">
    <p class="services-margin">In case of an emergency, please contact an appropriate service in the ASEAN countries for a prompt response. The numbers can be dialed from both landline and mobile phones and include the Police Department, Fire Department, and Hospital Ambulance services. </p>
    <hr>
    <div class="row">
      <div class="col-lg-6">
        <div class="input-group">
          <input type="text" class="form-control" placeholder="Search for..." ng-model="search">
          <span class="input-group-btn">
            <button class="btn btn-default" type="button">Go!</button>
          </span>
        </div><!-- /input-group -->
      </div><!-- /.col-lg-6 -->
    </div>
    <hr>
    <div class="row">
        <div class="col-md-6" ng-repeat="service in services | filter:search">
          <div class="media">
            <div class="media-left">
                <img class="flagsize" ng-src="{{service.flagimgurl}}">
            </div>
            <div class="media-body">
              <h4 class="media-heading country-title" ng-bind="service.country"></h4>
              <table class="table">
                <tr class="remove-border">
                  <td ng-bind="service.hl1"></td>
                  <td class="text-left">
                    <div ng-bind="service.hl1num1"></div>
                    <div ng-bind="service.hl1num2"></div>
                    <div ng-bind="service.hl1num3"></div>
                  </td>
                </tr>
                <tr class="remove-border">
                  <td ng-bind="service.hl2"></td>
                  <td class="text-left">
                    <div ng-bind="service.hl2num1"></div>
                    <div ng-bind="service.hl2num2"></div>
                    <div ng-bind="service.hl2num3"></div>
                  </td>
                </tr>
                <tr class="remove-border">
                  <td ng-bind="service.hl3"></td>
                  <td class="text-left">
                    <div ng-bind="service.hl3num1"></div>
                    <div ng-bind="service.hl3num2"></div>
                    <div ng-bind="service.hl3num3"></div>
                  </td>         
                </tr>
                <tr class="remove-border">
                  <td ng-bind="service.hl4"></td>
                  <td class="text-left">
                    <div ng-bind="service.hl4num1"></div>
                    <div ng-bind="service.hl4num2"></div>
                    <div ng-bind="service.hl4num3"></div>
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
        </div>
</div>
        <!-- Additional content goes here -->

Answer №1

Your HTML structure is currently displaying information for all countries in a single table, with flags for each country placed outside of the table. This makes it difficult to separate the information stored in the table.

To improve this setup, consider handling both the flag and service information for each country simultaneously. Start by converting your table elements into <div> containers, assigning classes to these new divs, and adjusting their order:

<div class="country">
    <div class="media-left">
      <a href="#">
        <img class="media-object flagsize" src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/Flag_of_Brunei_1906-1959.svg/1000px-Flag_of_Brunei_1906-1959.svg.png" alt="...">
      </a>
    </div>
    <div class="country-info">
      <h4 class="media-heading country-title" ng-bind="service.country">Brunei</h4>
      <div class="left" ng-bind="service.hl1">Service 1</div>
      <div class="right" ng-bind="service.hl1num1">111</div>
      <div class="left" ng-bind="service.hl2">Service 2</div>
      <div class="right" ng-bind="service.hl1num2">222</div>
      <div class="left" ng-bind="service.hl3">Service 2</div>
      <div class="right" ng-bind="service.hl1num3">333</div>
    </div>
</div>

This way, you can easily target and style the contents as needed :)

img.flagsize, .country-info {
  max-width: 200px
}

.left {
  float: left;
  clear: left;
}

.right {
  float: right;
  clear: right;
}

Ensure that .country-info has the same width as img.flagsize to prevent layout issues:

img.flagsize, .country-info {
  max-width: 200px;
}

Check out a demo of this structure in action here.

By following this approach, you'll have more flexibility in customizing the layout without encountering spacing or alignment challenges. Hope this solution helps! :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting MaterialUI: Is there a way to prevent the InputLabel text from disappearing when setting a background color on the Select component?

My goal is to change the background color on dropdown elements while keeping the default text visible. Currently, if I don't explicitly set a background color on the Select component, the text specified in the InputLabel displays correctly. However, o ...

Counting the number of key-value pairs for a specific key in a JSON data can be achieved by implementing

Is there a way to determine if __metadata and ItemToEkbeNav are the root elements for their children who have key-value pairs? I've attempted various methods such as Object.keys().length and Array.isArray(), but haven't been able to retrieve the ...

Implement a customized toString method for components in ReactJS

Looking to modify the toString method of a class component in reactjs? Check out the code snippet below class C1 extends React.Component{ render(){ return ( <div> {C2.toString()} </div> ) } } class C2 extend ...

Printing Strings in JavaScript IF Conditional Block

Hello there! I am looking for assistance with a JavaScript concept. Recently, I created some code where in the HTML file, there is a div element with an id of "GetID" where the string outputs are meant to be displayed. The JavaScript code looks something ...

Control the switch for CSS selectors

Consider the following scenario where CSS rules are defined: <style> table {background:red;} div {background:green;} </style> In addition, there is HTML code that calls a JavaScript function: <table onclick="tu ...

Location of chat icon in Dialogflow messenger

After successfully embedding the Dialogflow messenger in my website, I noticed that in mobile view, the chat icon is blocking the bottom navigation bar. You can refer to the screenshot here. Is there a way to reposition the chat icon higher on the page? I ...

Press the designated button located within a table's td element to retrieve the values of adjacent td elements

I need to implement a functionality where clicking a button within a <td> element will retrieve the values of other <td> elements within the same row (<tr>). Here is the current implementation: $(document).ready(function(){ ...

Decoding a JWT Base64 string into JSON format

While attempting to convert a base64 encoded JWT header into a string, I encountered an unexpected output: {"alg":"RS256","typ":"JWT","kid":"1234" The output seems to be missing the closing bracket. However, when I decode the same base64 string usi ...

"An error occurred with the Ajax post request - bad request

I've encountered a strange issue while attempting to make a POST request using AJAX with the code snippet below: $('.login-form').on('submit', function(e) { e.preventDefault(); $.ajax({ type: "post", url: " ...

Using an HTML5 image icon as an input placeholder

Is there a way to incorporate an image icon into an input placeholder and have it disappear when the user starts typing, across all browsers? In trying to achieve this, I successfully implemented a solution for webkit (Safari+Chrome) using ::-webkit-input ...

Utilizing Angular JS to parse JSON data and showcase it in various tables

Just diving into Angular JS and looking for some guidance. Can someone show me how to parse and showcase JSON Data in separate tables using Angular JS? [ { "id": 0, "isActive": false, "balance": 1025.00, "picture": "htt ...

Unexpected results obtained from database with PHP fetch_assoc() function, loop malfunctioning due to potential integer conversion issue?

Here is the data retrieved from my query: T t0 t1 t2 t3 1390716665000 137 47 82 1390717359000 105 47 79 1390718399000 126 46 79 This is what my PHP code looks like: $i=0; while( $row = $result->fetch_assoc() ){ $RowTime = ( ...

Troubleshooting Tips: Removing a Specific Line from a Canvas Using Javascript

I need to find a method for removing a specific line without having to clear and redraw it. Learn more about clearing specific lines in Canvas with HTML5 I came across this question where everyone suggested clearing the entire page and redrawing it. Is t ...

Converting a stringified array object to an object using Expressjs

When working with Angular, I am sending stringified data using FormData. Here is an example: this.formData.append('data', JSON.stringify(this.collections)) Now my challenge is converting this string back to an object in my Express backend. The d ...

Validating a collection of related objects within an array using JSON Schema

Which specific keyword should be utilized in a JSON Schema to ensure that all elements of an array (which are all objects) adhere to the same schema? Illustration: "data": [ { //validated "id": 1, "name": "Bob", "ready": "Not Ready ...

When using the .html() method on an object element with the Quicktime classid, Internet Explorer tends to

When utilizing .html() to fetch HTML that includes an object with param tags, IE8 will remove the latter and return an empty object element. Check out this jsfiddle showcasing the problem: http://jsfiddle.net/L9rra/1/. Update: Looking for a solution to re ...

Dropped down list failing to display JSON data

I created a website where users can easily update their wifi passwords. The important information is stored in the file data/data.json, which includes details like room number, AP name, and password. [ {"Room": "room 1", "AP nam ...

Adjust the location of the scrollbar without affecting the alignment of the text

Currently, I'm experiencing a design issue with the textarea tag in my React project. The layout looks like this: https://i.stack.imgur.com/JG1sm.png I am looking to shift the scrollbar to the right without altering the text direction (rtl). Utilizin ...

Tips for sending JSON data through the POST method on an Android device

I have a URL and parameter called "data": URL: http://www.xxxx.ru/mobile-api-v1/query/ data={«type":1,"body":{"sortType":0,"categoryId":0,"count":50,"authorId":0,"lastId":0}} What is the correct way to include the key "data="? I keep getting an error mes ...

The "(click)" event doesn't fire upon clicking a material icon

After creating an <a> tag with a (click) event function call, I noticed that the click event works everywhere except for the arrows mat-icons within the code snippet below: <span *ngIf="section.pages.length>0"> <mat-icon *ngIf="secti ...