Tips for arranging several icons alongside containers in a grid format featuring six different boxes

I am struggling with positioning icons outside the boxes in my three column, two row grid layout. There are six containers total, arranged on 2 lines with three boxes on each row. The goal is to have icons displayed inline with the heading next to each box.

I have attempted to create a class for the icons within the "row" div but before each "column" div. Unfortunately, the icons do not appear where intended, instead showing up in the top right-hand corner.

.column {
  float: left;
  width: 22%;
  margin-left: 115px;
  letter-spacing: 3px;
  color: black;
  height: 270px;
  margin-top: 20px;
  border: 1px solid green;
}

.row.i:before {
  content: "";
  display: inline-block;
  clear: both;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<section class="section section-dark">

  <div class="row"><i class="fa fa-home"></i>
    <div class="column"><i class="fal fa-address-card"></i>
      <div class="column"><i class="fas fa-alarm-snooze "></i>
        <div class="column "><i class="fad fa-alicorn"></i>
          <div class="column">
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

The current outcome is not as expected, with the icons ending up in the top right-hand corner despite efforts to position them elsewhere.

Answer №1

Your HTML needs some checking. There are a few open divs and an icon placed incorrectly outside the column, which could affect its positioning.

To fix this issue, try adding spacing to your i icon. Here's how:

i {
    left: -30px;
    position: relative;
}

By applying these styles, you should be able to move the icon to its intended location, hopefully resolving the problem.

.column {
  float: left;
  width: 22%;
  margin-left: 115px;
  letter-spacing: 3px;
  color: black;
  height: 270px;
  margin-top: 20px;
  border: 1px solid green;
}

i {
  left: -30px;
    position: relative;
}
.i:before {
  content: "";
  display: inline-block;
  clear: both;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<section class="section section-dark">
  <div class="row">
    <div class="column"><i class="fa fa-home"></i></div>
    <div class="column"><i class="fal fa-address-card"></i></div>
    <div class="column"><i class="fas fa-alarm-snooze "></i></div>
    <div class="column "><i class="fad fa-alicorn"></i></div>
  </div>
</section>

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

issue with bootstrap modals single firing when using remote data source

I am facing an issue with my table that contains a list of items, each item having a <select> element with different statuses. Here's how the process is supposed to work: Upon changing the status, a modal should pop up. The modal suc ...

Display a preloader image while waiting for the content to load using jQuery or AJAX

Hey there, I could really use some help with a little issue. I've been trying to use the click() and load() functions to bring my content into a specific CSS class. $("#feed").click(function(){ $(".homefeed").load("feedcontainer.php"); ...

Prevent scrollbar from appearing while splash page loads

Looking for help with a script to create a splash/intro page loader. $(function(){ setTimeout(function() { $('#splash').fadeOut(500); }, 6000); }); The current script hides the intro page after 6 seconds, ...

Having difficulties loading my stylus stylesheet onto my jade HTML page using expressjs

Within my express application, I am attempting to load the style properties from a styles module engine. Unfortunately, I am facing difficulties in loading my style. Here is the structure of my folders: myNodeApp -node_modules -styles - ...

Combining my CSS and JS files is causing code issues (works on my Mac, but not on the server)

Currently, I am in the process of merging my CSS and JS files before minifying them with the YUI compressor. My web application functions perfectly when each file is linked individually. Now, I am attempting to combine all the files into one single CSS fi ...

Spinning an SVG circle using a group element

I'm interested in rotating an SVG circle without affecting the rotation of other elements. https://i.sstatic.net/Be501.png My attempt to rotate the white circle using rotateZ(15deg) resulted in this: https://i.sstatic.net/GMp96.png This is the prog ...

How can I enhance the appearance of my custom field using CSS in Advanced Custom Fields?

Utilizing the Wordpress Advanced custom field plugin, I have successfully added a custom field to my site. Within this custom field, I have inserted images and now I am looking to center them on my page using CSS styles such as margin: 0 auto. If you&apo ...

How can I achieve a full-width div without using the container-fluid class while still maintaining the width and structure of

I am looking for a full div without the container-fluid class while keeping the container width fixed. The structure of the container should not change as I need another div inside the container. The structure should remain as it is. .main { padding: ...

formula for an arbitrary velocity vector

In the game I'm developing, I want the ball to move in a random direction on the HTML canvas when it starts, but always with the same velocity. The current code I have is: vx = Math.floor(Math.random() * 20) vy = Math.floor(Math.random() * 20) Howev ...

div with fixed position and scrollable content

I'm exploring ways to create a simple webpage layout inspired by the traditional index setup. The idea is to have a fixed header/navbar div that is 200px in height, with a second div below it containing scrollable content that fills the remaining vert ...

Displaying default tab content while hiding other tab content in Javascript can be achieved through a simple code implementation

I have designed tabs using the <button> element and enclosed the tab content within separate <div></div> tags like shown below: function displayTab(evt, tabName) { var i, tabcontent, tablinks; tabcontent = document.getElementsB ...

What is the most effective way to retrieve the inner HTML of an HTML tag using JavaScript or jQuery?

Let's consider the following code snippet: <p class="question"> this is my paragraph <p> And i'm inside tag in question class <h1> And this is my heading</h1> </p> </p> Now, the challenge is t ...

Exploring the world of interactive storytelling through a basic PHP text adventure

I recently completed coding a text adventure using functions like fgets(STDIN) that works in the command line. Now, I want to convert it to run on HTML (internet browser) but I'm facing a challenge. I am unsure how to transition from this: $choose=0; ...

Having trouble getting a jQuery variable to work as an argument in an onclick function for an HTML

success: function(jsonresponse) { data = JSON.stringify(jsonresponse); $.each(JSON.parse(data), function (index, item) { var Id=item.id; var JobId=item.JobId; var eachrow = "<tr>" + "<td>" + item.id + "</td>" ...

Custom field data in WordPress

I'm having difficulty formatting the prices of certain products using a custom field (unit_price). The value is 3.2, but the code only displays 3 because it doesn't recognize commas or dots. Is there a way to display the full value? any assistanc ...

Menu Navigation: Sequentially Colored Badges for Navigation Items

Within the MainService.ts file, there is a function that can alter the color set in badgesColorSet. The json config already defines 3 colors and the goal is for these colors to change each time the website is refreshed - for example, changing from red to g ...

Fuzzy division following a CSS transformation/animation

I have been working on a content slider, using the guidelines from this demonstration However, I have encountered an issue where my content, which consists of a few divs, appears slightly blurry after the CSS transition completes. This problem only seems ...

"Encountering an index error while using PHP, CSS, and AJAX

I've been struggling with this issue for the past five days, but nothing seems to be working. I have scoured through numerous posts on this topic, yet none of the solutions provided have helped me. Currently, I am using an OpenCart CMS and my goal is ...

Serve an HTML file with CSS/JS directly from the server disk to the client's browser

I'm currently facing a challenge that involves securely rendering and serving HTML files (along with CSS, JS) from the local disk on the server to a web application running in the client's browser. APPLICATIONS A front-end web app is built usi ...

Is there a difference in font size between Firefox and Webkit browsers?

The issue with different fonts (Myriad Pro) displaying in Firefox and Webkit browsers (such as Chrome and Safari) has been noticed. Testing on Internet Explorer has not yet been conducted. form.standard.small input[type=submit] { width: 104px; h ...