incorporate tiles into your html code

I am having trouble with the layout of my tiles. Every time I add a new tile, it appears beneath the existing ones instead of beside them. Here is the code I am using:

<div class="tiles">
          <div id="metro-array">
              <a class="metro-tile" style="cursor: pointer; width: 110px; height: 110px; margin:10px; display: block; background-color: deepSkyBlue;  color: #fff;">
                Name
                Age
              </a>
              <a class="metro-tile" style="cursor: pointer; width: 110px; height: 110px; margin:10px; display: block; background-color: deepSkyBlue;  color: #fff;">
               name2
               Age 2
              </a>         
    </div>
    <script src="js/tileJs.js" type="text/javascript"></script>
  </div>

Here is my CSS for the tiles:

 .tiles {
    margin: 0px;
    font-family:'Lato', Helvetica, sans-serif;
    line-height: 28px;
    font-size: 16px;
    color: #333;
    font-weight: lighter;
 }

 #metro-array a,  #downloads a {
    text-indent: 5px;
    font-weight: normal;
    text-transform: uppercase;
 }

I attempted to manually add left margins to fix the issue, but since I will be adding tiles dynamically, this method is not feasible. Can you please advise on what changes I should make to my CSS?

Expected Result:

Current Output:

Answer №1

Include

float:left

in your stylesheet for #metro-array a

See it in action here : Live Example

Answer №2

insert float:left in place of #metro-array a

Answer №3

Feel free to give this a shot. #metro-array a{float:left;}

Answer №4

To achieve the desired layout, include the property float:left in the CSS for #metro-array a

Here's the updated code:

 #metro-array a,  #downloads a {
   text-indent: 5px;
   font-weight: normal;
   text-transform: uppercase;
   float:left;
   }

You can view and test the changes using this link: http://jsfiddle.net/La2g1md6/1/

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

Refreshing a controller by clicking it from another controller in AngularJS

Here is some HTML code I have been working on. I have a function in moreThanOne.html which sets a variable show to true. This causes it to load one.html for the first time and call the init method of my controller. However, if I change the valu ...

The HTML.LabelFor function is failing to display correctly

I am facing an issue with Html.LabelFor where it doesn't render properly. Instead of displaying the value of ProviderName like "AT&T," it just shows the text ProviderName instead of the actual value. <div id="ServiceProvider" class="main_filter" n ...

Use jQuery to choose specific images, then duplicate the chosen image's "href" attributes

On my webpage, there are several images loaded in a specific format: <a class="something" href="1.html"> <div class="something"> <img alt="name" src="https://www.homepage.com/.1.jpg"/> </div> </a> I am lo ...

Styling speech bubbles and dividing lists with CSS

Looking to create a speech popup with an internal menu that has items separated by borders. The challenge arises when there is an even number of items - how can the border extend inside the speech pointer? After some consideration, also need to account fo ...

Enhance your web design with the latest Bootstrap 5.2

I attempted to implement a tooltip using jquery in my jquery datatable, but unfortunately the tooltip is not appearing. Below is the code snippet: render: function (data, type, row, meta) { var total = row.success + row.error; if (row.isConsumed = ...

How do you efficiently include several elements within a single column in Boostrap 5?

I've been working with Bootstrap 5 to display a grid of images similar to this link, but the images are not displaying as intended due to some CSS code. #projects img { width: 100%; height: 100%; } <section id="projects"> ...

The Bootstrap 4 Nav Pills feature fails to activate upon second attempt

While working on a bootstrap page with nav pills to switch between two HTML forms, I encountered an issue. Initial visit to the page works perfectly fine, but upon returning from the homepage or refreshing the page, the navigation stops functioning. Inter ...

Using Backbone.js, the append method replaces the existing HTML content instead of simply adding an

As a beginner in backbone.js, I decided to start building a small todo application using examples from the "Backbone fundamentals" by Addy Yosmani. However, I encountered an issue with my code where instead of appending each item to the list view, it repla ...

The applet failed to load on the HTML webpage

I'm having trouble getting this applet to load on an HTML page. I've already added full permissions in the java.policy file and I'm using the default HTML file from NetBeans Applet's output. /* Hearts Cards Game with AI*/ import java.a ...

Position three paragraphs in the center of a div container

Is there a way to center 3 paragraphs in a div? I have separate divs for each paragraph and one main div that holds all three nested divs. div.first { font-family: 'Kanit', sans-serif; color: aliceblue; width: 30%; float: left; ...

What is the best approach for extracting the content of mouse hover elements using Python and selenium through a loop?

I am currently working on a project where I am utilizing Selenium to extract information from a mouse hover box that appears to display relevant details for each review. While I was successful in retrieving data for the first review, I am facing challeng ...

Dealing with CSS overflow issues in Safari, Chrome, and the ancient IE 6

Are Safari and Chrome compatible with overflow? How does IE 6 or higher handle overflow? ...

Create a clickable element that executes a Python script when activated

Currently, I am working on a website project that requires taking two input files and generating the differences between those files as output. To achieve this, I have developed a textcompare program in Python and created the initial two webpages that hand ...

Tips for customizing the toggle animation styling

I'm new to HTML and CSS, currently working on designing a website for our conference. I've implemented a toggle effect for displaying the information about invited speakers along with their research interests using the following code: <!DOCTY ...

CSS nested classes incorporate styles that are distinct from the less nested styles

I am currently working with CSS, where I have defined the following style: .main> .test{ display: block; background:#FFFFFF } The style is saved in a file that I prefer not to modify. However, my new HTML structure looks like this: <div class="m ...

Animate hovering over a specific element within a group of similar elements using jQuery

Hi there! I recently started exploring Js and jQuery, and I was able to create a cool width change animation on a div when hovering over another. However, I ran into an issue when trying to implement this with multiple sets of similar divs. Whenever I hove ...

Columns nested within tabs in Bootstrap4

My current layout is shown here: https://i.sstatic.net/vQsqz.jpg I am looking to incorporate nested columns within these tabs. My attempted solution so far has been unsuccessful. The issue I am facing is that the columns within the specific tabs are ove ...

"Bootstrap's modal-backdrop element presents a striking fade effect as it

Issue I am facing a problem related to Bootstrap, specifically with a modal in my HTML file. Whenever I call the modal, it appears with a fade-in effect. The code for my modal: <div class="modal fade" id="exampleModal" tabindex=& ...

Main menu items failing to display sub menu options

I am in need of assistance as I am facing the same issue on two WordPress twin websites that are using the same theme (Newmagz), which is no longer purchased and therefore not supported. The submenus in the main menu are simply not appearing. I have checke ...

Show MySQL SELECT output on a HTML page

I have created a button that opens a new .html page in a new browser tab, allowing users to input data that is then stored in a MySQL database using a PHP script. Now, I am looking for a way to display the content of my MySQL database on my index.html fil ...