What is the best way to layout a div containing three Font Awesome icons in order to ensure the website remains responsive?

Is there a way to position a div containing three font-awesome icons in a responsive design, with one icon on the left, one in the middle, and one on the right using position: absolute/relative?

When I apply position: absolute to the div wrapping the icons, they end up stacking on top of each other.

This is my current approach. However, due to the margin-top: 6vw, it doesn't respond as smoothly when resizing the browser compared to others that use percentages because I'm using position: absolute. How can I rectify this issue?

#canvas {
    position: absolute;
    bottom: 62%;
    left: 35%;
    width: 600px;
    height: 250px;
    margin: 0 auto;
}

#central-skills {
    margin: 0 auto;
    max-width: 1300px;
    margin-top: 15vw;
    font-family: 'Roboto Condensed', sans-serif;
    user-select: none;
    font-weight: bold;
    font-size: 2.4rem;
}

.trying {
    text-align: center;
}

#website ul {
    margin-top: 2rem;
    list-style-type: none;
}

#websites li:before {
    content: "\2714\0020";
}

#websites {
    position: absolute;
    top: 50%;
    max-width: 100%;
    font-size: 0 !important;
}

.trying {
    position: absolute;
    top: 20%;
    left: 35%;
}

.websites {
    text-align: center;
    position: absolute;
    left: 35%;
    bottom: 43%;
}

#websites {
    position: absolute;
    top: 55%;
    margin-left: 10rem;
}

#websites ul {
    margin-top: 5rem;
}

#websites li {
    font-size: 2.4rem;
}

.list-adv {
    display: inline-block;
    border: 2px solid #77dff1;
    padding: 6rem;
    margin: 0;
    color: #77dff1;
}

.scratch {
    padding: 6rem 5.5rem 6rem 5.6rem;
}

.mobile-skills {
    visibility: hidden;
}
#icons {
    font-size: 10rem;
    max-width: 1000px;
    margin: 0 auto;
    margin-top: 6vw;
}

.fa-html5 {
    float: left;
}

.fa-js-square {
    position: absolute;
    left: 50%;
    -ms-transform: translate(-50%);
    transform: translate(-50%);
}

.fa-css3-alt {
    float: right;
}
<head>
  <script defer src="/static/fontawesome/fontawesome-all.js"></script>
</head>
<body>
<div id="central-skills">
            <div id="canvas">
                <canvas class="canvas"></canvas>
                <script src="js/canvas.js"></script>
            </div>
            <div id="skills" style="display: none;">
                <h6 class="trying">Currently I consider myself familiar and comfortable with:</h6>
                <h6 class="mobile-skills">html CSS JavaScript jQuery Bootstrap Canvas</h6>
                <div id="icons">
                    <i class="fab fa-html5"></i>
                    <i class="fab fa-js-square"></i>
                    <i class="fab fa-css3-alt"></i>
                </div>
                <div id="websites"> 
                    <ul>
                        <li class="list-adv 1">Responsive</li>
                        <li class="list-adv 2">Using a clean and easy to follow code</li>
                        <li class="list-adv 3">Clean and good-looking</li>
                        <li class="list-adv 4">Optimized for Search Engines (SEO)</li>
                        <li class="list-adv scratch">Coded from scratch (unless there is a need of a CMS)</li>
                    </ul>
                </div>
            </div>
        </div>
        </body>

Answer №1

If you want to align those icons in a container div using flexbox, you can simply apply the property "justify-content: space-between". This will position the icons on the left, center, and right of the container.

#icon-container {
    font-size: 12rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-top: 8vw;
}

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

Difficulty with aligning input boxes in ASP.NET Core Razor Pages

I'm struggling to center some input boxes within my ASP.NET Core web application. I've experimented with CSS solutions and tried various HTML approaches like using the class = "text-center", but so far, I haven't achieved the desired results ...

Retrieve the image source, but only select one if there are multiple sources available

Trying to utilize jQuery to retrieve the image src, I have the following code: HTML <div class="post_container"> <img src="http://imageurl.com"> </div> <div class="appendedimageContainer"></div> Javascript var imageSrc ...

Discovering modifications to CSS using selenium

Currently, I am working on an ajax form where CSS elements are dynamically changed. I am curious to know if it is feasible to verify these changes using Selenium. For example, checking if the background color changes from #ffffff to #000000 after clicking ...

Is it feasible to overlay a PNG image on top of a button while still allowing the button to be clickable?

Can you place an image (.png) on top of a button and still make the button clickable? https://i.sstatic.net/9Z8nH.jpg ...

Adjusting the dimensions of an image based on the size of the device screen

Is there a way to show my image on different devices in full screen automatically adjusting to fit the display? I attempted using the "Width: Device-width" option but it didn't work. Any suggestions? ...

Shifting hues of dots within a grid according to the passing of time

As a newcomer to the world of coding, I have conceptualized an idea for a visually appealing clock. My goal is to visually represent the passage of time throughout the day. To achieve this, I have devised a grid system where each dot on the grid represents ...

What steps should I take to align my header to the topmost section of the browser window?

I'm having an issue with my header background image not lining up exactly to the top of the browser. There is a gap between the header image and the top of the browser, showing the background color. I want the header to extend all the way up to the to ...

Is it possible to use CSS transitions to animate an absolute positioned element?

I am having trouble getting a CSS transition to work for animating an element's position change. I have tried using the all properties in the transition declaration like in this example: http://jsfiddle.net/yFy5n/3/ However, my goal is to only apply ...

Retrieve Checkbox within a Span using Jquery

Trying to achieve the selection of a checkbox when a user clicks on a div using jQuery. The provided fiddle shows my attempt: http://jsfiddle.net/5PpsJ/ The code snippet I have written so far is as follows, but it doesn't seem to select the checkbox ...

Creating an HTML file with a Windows-inspired icon and file name design using CSS

I searched everywhere on the internet but couldn't find a solution. If anyone knows of a similar link to my question, please share it with me. I am trying to achieve a design similar to Windows icons and file names in HTML using CSS. Please refer to ...

The matter at hand pertains to the aesthetics of formatting HTML components

Below is my attempt at creating a search box and styling it. However, I am encountering an issue where the CSS properties applied to the box are not being rendered. I have tried including the CSS in a separate file as well as within the script itself, but ...

Unable to expand or collapse rows in ng-table

Looking to implement an expand and collapse feature for ng-table, where clicking on a row should expand it to show more detail. However, currently all rows expand on click. Any ideas on how to achieve this? Any assistance would be greatly appreciated, tha ...

Vertically aligning text in separate div containers

Currently, part of my dashboard page is styled using the Bulma CSS framework. One feature is a 'Widgets' feature with three large containers displaying key facts such as the number of sales, new customers, etc. The issue I'm facing is that ...

Challenges with formatting the <legend> tag and grid setup in bootstrap 4

My intention was for it to be displayed like this: But unfortunately, it is appearing like this instead: You can see that the word "fruit" is misaligned. I am currently using Bootstrap 4 alpha v6. Here is the code snippet: <fieldset class="form- ...

Tips for maintaining an active link using CSS

I am looking to create a hover effect for links that remains active when the user is on a specific page. Essentially, I want a background to appear behind the link when it is visited. Below is the HTML code: <div class="menudiv"> <div id="menu"& ...

Maintaining image ratio on the entire screen

I am in search of a way to create a webpage that includes the following elements from top to bottom: Full-screen width image/background-image (maintaining aspect ratio) Navigation bar (aligned at the top right of the image) Some text Another full-screen ...

The ">" CSS child selector does not seem to be functioning correctly with specific properties

While experimenting with applying CSS properties to direct child elements of a parent element using ">", I noticed that it works smoothly with certain properties like borders, but not so much with font-related properties such as color and font-weight. ...

What is the best way to use JavaScript to fill in missing images with alternative HTML content?

As a provider of a service that helps users find the location of pictures, I face a challenge due to the fact that the pictures are stored on another internal site. Some users may not have access to this site as my service offers additional information. Th ...

Internet Explorer Overflow Scroll

Is there a way to remove scrollbars in Internet Explorer while still allowing scrolling? The layout looks fine in FireFox/Chrome/Safari, but is completely unusable in IE. Below is the CSS I am using: <style type="text/css"> table { display:inli ...

Select the input element in CSS that does not have a parent with the class name 'classname'

In my stylesheet, I have a specific rule that styles various input fields and select elements. However, I'm facing an issue where this styling is being applied to all text fields on the page, including ones inside certain elements with a specific clas ...