Issue with left alignment of Div element

After creating a responsive footer, I encountered an issue where the text HELP and back icon were not aligning to the left as intended and appeared stuck in the middle. How can I adjust them to move to the left side? Below is the code snippet for reference:
HTML code:

<div id = "footer">

                <span id = "logout" class="pull-right">
                   <span id = "logoutIcon"></span>
                    <span id = "logoutText">
                        LOGOUT
                    </span>
                </span>

                <span id = "logout1" class="pull-right">
                   <span id = "logoutIcon1"></span>
                    <span id = "logoutText1">
                        HELP
                    </span>
                </span>

            </div>  

CSS code::

#footer {
            background-color: #125e9a;
            bottom: 0;
            height: 5%;
            position: absolute;
            width: 100%;
        }  
#logout1 {
        display: block;
        height: 100%;
        margin-left: 3%;
        padding: 2.5%;
        width: 30%;
    }
    #logoutIcon1 {
        background-image: url("../JunosImages/mob/back-arrow_normal_tab.png");
        background-repeat: no-repeat;
        background-size: 100% 100%;
        display: block;
        float: left;
        height: 14px;
        margin-top: 2%;
        width: 10px;
    }
    #logoutText1 {
        color: #fff;
        float: left;
        font-size: 14px;
        font-weight: 600;
        margin-left: 7%;
    }  

Answer №1

You clicked on both buttons to the right. Simply change the class from pull-right to pull-left for the second button and switch their positions.

Furthermore, it's advisable to steer clear of using ID selectors in CSS.

Answer №2

If you are utilizing bootstrap, please review the following answer with the class "pull-left";

Answer №3

Here is how I would approach it:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .footer {
        background-color: #125e9a;
        bottom: 0;
        height: 5%;
        position: absolute;
        width: 100%;
    }  

     .footer-links{
          display: block;
          float:left;
          margin-left: 3%;
          padding: 0.5%;
          width: 98px;
     }
     .arrow{
          background-color: green;
          height: 14px;
          margin-top: 2%;
          width: 10px;
     }
     .footer .button-text{
          color: #fff;
          font-size: 14px;
          font-weight: 600;
          margin-left: 7%;
     }

     .footer-links-wrapper{
        width: 215px;
     }

    </style>
    </head>
    <body>

    <div id="footer" class="footer">
        <div class="footer-links-wrapper">
            <span id="help" class="pull-left footer-links">
                 <span id="left-arrow" class="arrow left-arrow"> << </span>
                 <span id="help-text" class="button-text">
                                HELP
                 </span>
             </span>

            <span id="logout" class="pull-right footer-links">

                <span id="logout-text" class="button-text">
                                LOGOUT
                </span>
                <span id="right-arrow" class="arrow right-arrow"> >> </span>
            </span>
        </div>
    </div>  
    </body>
    </html>
  1. It's generally best practice to define styles in classes rather than using ids
  2. Avoid spaces when assigning attribute values with "="
  3. Make sure class and id names are descriptive of their purpose, similar to comments
  4. You may want to include additional styles for a better visual representation in the local browser

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

Troubleshooting Website Navigation Bar and Layout with HTML, CSS, and Bootstrap5

I am facing a challenge with navbar positioning. My navbar items are missing after adding the image below. I have attempted to adjust the element positions but to no avail :( I also tried to create a fixed-top navbar, but it didn't work either :( I ...

Navigating dynamic URLs with various URI segments in cPanel

<a href="www.mysite.com/index.php?information/adminpanel/<?php echo $id;?>" name="approve" id="approve" ">Approve >></a> After redirecting to the specified URL, the correct ID is displayed in the address bar but unfortunately, ...

Having trouble making radio buttons clickable with jQuery/JS?

Having a minor issue as a beginner, I am struggling to make buttons within a DIV clickable. The top line consists of 5 buttons that work perfectly. When clicked, a 2nd row appears as expected, but for some reason, I can't click on them. What could be ...

When dalekjs attempted to follow a hyperlink with text in it, the link failed to function properly

My goal is to retrieve an element from a list by clicking on a link containing specific text. Here is the HTML code snippet: <table> <td> <tr><a href='...'>I need help</a></tr> <tr><a href=&a ...

Creating a countdown timer for a specific date and time using web technologies

I'm looking to create a timer countdown that is set to a specific date and time, such as June 1st at midnight. The code should display the remaining time until that date or time. ...

Gathering information from a website by using BeautifulSoup in Python

When attempting to scrape data from a table using BeautifulSoup, the issue I'm running into is that the scraped data appears as one long string without any spaces or line breaks. How can this be resolved? The code I am currently using to extract text ...

Slideshow Display Suddenly Halts at the Last Image

I am currently working on a Bootstrap JS Carousel that showcases several images stored in the project folder. Each image's filepath is retrieved from an SQL Server database and displayed within the carousel. While the images are displaying correctly ...

Ways to incorporate padding into md-card using Angular 2 material

Need assistance with adding padding to md-card in angular2 material. I am using md-card to display my product list but struggling to add padding on them. Here's what I have tried: product.component.html : <p> Product List </p> <div ...

Incorporating a search icon next to the search term in the navigation bar

As part of my coding practice, I am working on creating a website similar to the one shown. I have encountered an issue with adding a search word alongside a search icon like in the image. I have successfully added the code for the word "Sök," which mean ...

Is retrieving data from the database causing unexpected additional space to appear in the textarea?

I am facing an issue with a basic php file that fetches information from a MySQL database and displays it inside a textarea. However, when I access the file through browsers, there seems to be extra space at the start and end of the text within the textare ...

Utilize ASP to limit the application of a CSS file exclusively to the child page

My website consists of a master page and several child pages. I have created specific CSS classes for styling. However, I only want certain child pages to utilize these styles while the master page should always use them. How can I limit the access to th ...

Is it possible for the ImageListItem Img to occupy the entire Card Space?

I am faced with the challenge of making an ImageListItem occupy all available space within a card. The goal is to have a rounded Card with an image background and a text bar at the bottom. However, I am struggling to get the ImageListItem to expand beyond ...

AMP causing distortion in images

My images are stretching on this page and I cannot figure out the cause. Any help would be greatly appreciated. The issue seemed to arise after I implemented Bootstrap, but I am using a customized version of Bootstrap that only includes grid system and fo ...

CSS-Styled Vertical Timeline

I have been working on creating a vertical timeline with icons embedded within it. I initially used this as a reference point. I was able to achieve the desired layout by adding extra spans inside the div. However, the end result appears somewhat cluttere ...

Bootstrap CDN causing modals to fail to appear

Here are the stylesheets I am currently using: script(src="/js/application.js") script(src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js") script(src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js") link(rel="styl ...

Swapping out DIVs with jQuery

Currently, I am working on a project for a client where I need to create a sortable biography section using jQuery. Initially, I had a setup with just two bios (first person and third person) which was functioning perfectly: $("a#first").click(function() ...

Ways to create distance between 2 select elements with CSS?

Having trouble with the spacing between two select fields on a form? Specifically, you want the start time, start time meridian, end time, and end time meridian all in a single line. Any suggestions or solutions to this issue would be greatly appreciated! ...

Incorrect formatting of HTML email on Outlook

Here is the code snippet I am using for an HTML email: <div style="background-color:red;max-width:600px;height:140px;margin-left:auto;margin-right:auto;"> <img src="https://via.placeholder.com/140x99" height="140" wi ...

When using jQuery and AJAX together, it seems that the POST method is returning

Currently experimenting with Cloud9. The current project involves creating an image gallery. On the initial page: There are a few pictures representing various "categories". Clicking on one of these will take you to the next page showcasing albums fro ...