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

Enhancing w3-import-html with JavaScript

<div id="import" includeHTML="page.html"></div> function getInclude() { var x = document.getElementById("import").includeHTML; //returns 'undefined' alert(x); } function modInclude() { document.getElementById("import") ...

Troubleshooting JSON Parsing: No data is displaying in Kilometers

As a new programmer, I am exploring the Google Matrix API. Upon receiving the response, I am trying to extract the value of "text" as "1686 km" using Json Parsing. Thank you "destination_addresses" : [ "San Francisco, Californie, États-Unis" ], ...

How to Handle Date Formatting in Angular with Ionic

Utilizing the ionic framework to create a hybrid app with Angular, I have encountered an issue with a form that includes two input boxes: one for date and one for time. The date input's value is being saved in the database in this format: Tue Mar 24 ...

Storing a color palette in a MySQL database from an HTML table

In my project to create a website for sharing quilting patterns, I have encountered an issue with the color changes in the HTML table. Despite allowing users to click and change cell colors, these adjustments are not saved permanently. As a solution, I a ...

The nested div does not have scrolling functionality

I'm currently working on making a nested div scrollable, but I'm encountering some challenges. The problematic div in question is the one with the "items" class. <body> <div class="page-wrapper"> <div class="header">Heade ...

Creating expandable card components with React and CSS using accordion functionality

I am currently working on creating a card that will expand its blue footer when the "view details" link is clicked to show lorem text. However, I am encountering an issue where the blue bottom of the card does not expand along with the lorem text. You can ...

I'm interested in learning the best way to insert the images from this JSON file into the corresponding div elements

I have completed developing a clone of an Instagram web page. Although I can retrieve data from the JSON file and insert it into the <img> tag, I am facing difficulty in displaying each image above its respective .below-image div with consistent spac ...

Yeoman webapp error: Issue with incorrect CSS path in subfolder

I have been using the yeoman webapp generator (0.5.0) and my app directory is structured like this: app/ ├── dir1 │ └── index.html ├── favicon.ico ├── images ├── index.html ├── robots.txt ├── scripts │ └ ...

Cleaning user Input in Rails 4

I've been developing an API using Ruby on Rails and I'm curious to know if there are any built-in methods or libraries/gems in Rails that help with sanitizing JSON and SQL data. Does Rails 4 handle this automatically? Specifically, I'm conce ...

Having trouble with JSON stringify when dealing with an array of JSON objects?

Encountering an issue with requiring a JSON file in Node after using JSON.stringify(...). The code writes the file out without any strange characters at the end, properly closing the last JSON object with }, followed by ] to end the array. fs.writeFile( ...

Adaptable Design for Smartphones

Currently in the process of creating a website for my brother with Joomla 3.4 and Bootstrap. This marks my first venture into building a responsive site, so I'm seeking guidance on essential elements to include in my CSS such as font sizes in specific ...

Learn how to save user input from form fields and text areas into JSON format using Angular

Is there a way to add comments using Angular when a user clicks on a button? Currently, whenever text is entered in the input field or textarea, it disappears and an empty block without any name, country, and comments is displayed. The entered text should ...

I have tried using justify-content: center; and align-items: center; to center this div, but the container div is still not centered. How can I successfully center

I am having trouble centering the container in my HTML code HTML code:- <body> <div class="container"> <div class="image"> <img src="./images/image-qr-code.png" alt="qrcode"> & ...

Is it possible for the font size to adjust based on the heading (h1, h2, h3) I choose when using CSS to specify a particular font size?

What will happen if the following HTML code is used: <h1> This is text</h1> <h2> This is also text</h2> and CSS is applied to change the font size like this: .h1 { font-size: 30px } .h2{ font-size: 30px } Will both texts ...

Tips for troubleshooting objects within an Angular template in an HTML file

When I'm creating a template, I embed some Angular code within my HTML elements: <button id="btnMainMenu" class="button button-icon fa fa-chevron-left header-icon" ng-if="(!CoursesVm.showcheckboxes || (CoursesVm.tabSelected == 'curren ...

Convert a DateTime object to JSON using the Mongo C# driver's toJson

I have a dataset stored in MongoDB that looks like this: "trd" : ISODate("2003-12-08T00:00:00Z") Currently, I am retrieving data from Mongo as BsonDocument using the following approach: var builder = Builders<BsonDocument>.Filter; var ...

The Jquery Index() method often results in a return value of -

I have developed a function in JavaScript that creates HTML content. Within the test(test1) function, I am checking if test1.Test__c is null and changing the color accordingly. The line ".table-striped > tbody > tr.testcss" is responsible for changin ...

Position various images at specific coordinates on the screen using CSS

Looking for help with positioning four images on the screen using coordinates specified in the code. The top-left coordinate positioning is not displaying properly as intended. Can you assist in identifying and correcting the error? <!DOCTYPE html&g ...

When you hover over nested HTML-lists in a webpage, make the tree's long text lines expand gracefully using a combination of HTML, CSS

In my Angular 4 application, I have a left div that displays a tree of items as recursive HTML lists. When there is a long text, it gets cut off by the border of the div and a scrollbar appears. I want to have the text expand beyond the border and show in ...

Do you need to align images side by side and have clickable images positioned beneath each one?

After searching high and low, I couldn't find a similar question. My goal is to transform this from a vertical layout to a horizontal one: https://i.stack.imgur.com/4kZNM.png Check out the code snippet below: ghost<br class="newline"> <img ...