The items in the footer are not all aligned on a single line

Trying to create a footer with two linked images, I used justify-content: center, but it seems to be centering the images from the start rather than their actual centers. This causes them to appear slightly off to the left. Additionally, the images are stacking on top of each other instead of being in line as I intended.

.footer-contents {
    /* display: inline-block; */
    text-align: center;
}

.footer-logo {
    position: relative;
    /* align-items: center;
    justify-content: center; */
    /* margin: 0 clamp(10px, 3vw, 30px); */
    /* top: 80px; */
    /* flex-basis: auto; */
    height: 40px;
    width: auto;
}

.column {
    float: left;
    width: 33.33%;
    margin: 5px;
    /* padding: 5px; */
    vertical-align: middle;
}

.row {
    margin: 0 40%;
}
  
.row::after {
    content: "";
    clear: both;
    display: table;
}
<footer class="footer">
        <div class="footer-container bg-container">
            <div class="footer-content">
                <div class="row">
                    <div class="column">
                        <a href="https://twitter.com/">
                            <img src="https://img.icons8.com/color/48/000000/twitter--v1.png" alt="" class="footer-logo">
                        </a>
                    </div>
                    <div class="column">
                        <a href="https://instagram.com/">
                           <img src="https://img.icons8.com/color/48/000000/instagram-new--v1.png" alt="" class="footer-logo">
                        </a>
                    </div>
                  </div>
            </div>
        </div>
</footer>

Answer №1

First and foremost, there appears to be a typo error in your code. Your HTML references a class called "footer-content," while the CSS mentions a class named "footer-contents." This discrepancy could be causing your issue.

Alternatively, if you simply want to center two images, you can achieve this with less HTML and CSS. Here's a simplified version:

<footer class="footer">
    <div class="footer-container bg-container">
        <div class="footer-content">
            <a href="https://twitter.com/">
                <img src="./images/twitter-logo.png" alt="" class="footer-logo">
            </a>
            <a href="https://instagram.com/">
                <img src="./images/instagram-logo.png" alt="" class="footer-logo">
            </a>
        </div>
    </div>
</footer>

I have removed the row and column attributes (assuming they are not needed elsewhere) and utilized the text-align property instead:

.footer-content {
    text-align: center;
}

.footer-logo {
    height: 40px;
    width: auto;
}

If your images are on separate rows due to using a div element with display:block, consider using a span or directly placing the images without enclosing them in a div, as demonstrated above.

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

Collection of clickable images that lead to creatively designed individual pages

Being relatively new to JavaScript and jQuery, my knowledge is solid when it comes to HTML & CSS. Currently, I have a page with 20 minimized pictures (with plans to increase to 500+ images) that open into a new page when clicked. Although I have no issues ...

Tips for positioning a highcharts pie chart and legend in the middle of a page

I'm struggling to center my highchart data in a node/react single page application. Currently, it appears off-center like this: https://i.stack.imgur.com/ccR6N.png The chart is floating to the left and I would like to have everything centered within ...

The Google map is not showing up on the screen despite having entered the API Key

Trying to showcase a Google map on my website. Check out the code below:- <script> function initializeMap() { var coords = {lat: -25.363, lng: 131.044}; var mapObj = new google.maps.Map(document.getElementById('mapz') ...

Different floating divisions that are tightly packed adjacent to each other

I'm dealing with dynamically created divs that have variable content, all following the same CSS rules. My goal is to organize them into 2 columns without any space in between. I attempted to use float: left/right, but there still remains space at the ...

Utilizing HTML5 audio elements with jQuery enhances the auditory experience

As I delve into creating a simple media section for a website, I have encountered some challenges that I would like to address. Let me explain the issue I am facing. I currently have a 'play list' consisting of 'links' - represented by ...

Adding padding to the navbar when collapsed causes extra space between the brand name and the hamburger icon button in Bootstrap

I am in the process of creating a fixed-top navigation bar for my webpage. However, I have encountered an issue where there is excessive space between the "Brand" name and the collapsed menu icon when viewed on smaller screens. Here is a visual representa ...

Vue alert: Issue encountered in watcher 'childItems' callback - 'TypeError: Unable to access property 'tag' as it is undefined'

I am currently in the process of developing the Store page for a web application. I am utilizing Axios to retrieve product data and display it in a Vue template. While the backend functionality is working correctly and the frontend is rendering successfull ...

Looking for assistance with transferring a JavaScript array to my PHP script

Is there an easier way to transfer a JavaScript array to a PHP file? I've seen examples of using AJAX for this task, but I'm wondering if there's a simpler method. Below is a snippet of the code I'm working with: <html> <hea ...

Activate the Chrome Extension that allows you to open a link in a new tab with just a middle click or regular click, without closing the popup

When I try to click a link in my extension popup and open it in a new tab using "middle click -> open link in a new tab", the popup closes. Is there a way to keep the popup open so I can click on multiple links from my extension without interruption? A ...

Concealing JW Player Video Link within Source Code

<div id="movie">...</div> <script> player("film").customize({ width:800, height:400, playlist: [{ file: "https://movielink.mp4", image: "https://moviepic.jpg", tracks: [{ file: "http://movi ...

Navigating through Expression Engine and utilizing conditional statements

Would greatly appreciate some assistance with this issue. I am working on an Expression Engine website and encountering difficulties with simple conditionals for navigation active states. Despite having a color state designated within the styles, there s ...

Display the scrollbar within a flexitem by utilizing flexbox styling

I am currently setting up my HTML website with Bootstrap flex and I have a specific layout in mind. I want the inner div to have scrollbars while the outer div fills up the rest of the page. Take a look at this example: <div class="d-flex align-items- ...

Is there an issue with the functioning of Angular routing?

I've been working on setting up routing in AngularJS and it seems like the server is running smoothly. However, I'm facing an issue with the angular routing not functioning correctly; only the main.html page loads in ng-view, while second.html do ...

Incorporate VLC player into a webpage without any visible control options

Is there a way to embed a flash video in a webpage without showing any controls? I managed to embed a flash video using VLC with the following code: <embed src="img/Wildlife.wmv" height="480" width="640"> However, I want the video to play without ...

What is the most efficient way to gather all form inputs and then transmit them to an email address?

Could you please help me with creating a form page that collects user input data and sends it to my email? I am looking for solutions using only HTML, CSS, PHP, or JavaScript. Here is a preview of the page: Below is the PHP code snippet I've been wo ...

Utilizing a button's "data-" attribute to trigger a specific JavaScript function

I am trying to assign data to my buttons in a way that makes it accessible when clicked. While I can easily use JSON in a button's data attribute with a string as the key value, I am struggling to set the values to be a function instead. What I want ...

Using Jquery to select and apply functions to specified div elements

As someone who is relatively new to JQuery, I have a question regarding the .on() function. Take this example: $('div').on('click', function() {$(this).toggleClass('show-description');}); This code selects all the 'div& ...

Is it possible to create an HTML interface with Google Workspace Add-ons?

Recently, I've been on a mission to create a Google Workspace Add On that can display an iFrame. My journey led me to explore the documentation for Google Apps Script and Google Add Ons. From what I've gathered so far, it seems that I'll ne ...

Button Fails to Respond on Second Click

I have a button that triggers a JavaScript function. This function, in turn, initiates two sequential AJAX calls. Upon completion of the first call, it performs some additional tasks before proceeding to the second AJAX call. The button functions correctl ...

Extending an element beyond the boundaries of its container

I currently have 3 different divisions within the body of my document: a container, a parent, and a child element. My goal is to make the child element extend beyond its parent on the left side. However, when I try to achieve this by using position: ab ...