Troubles with aligning text and images in the footer due to CSS discrepancies

Can anyone assist me with a formatting issue I am facing?

I currently have a footer that contains text and a Facebook icon. However, I am having trouble aligning the Facebook icon directly to the right of the text.

If anyone could offer some guidance, it would be greatly appreciated!

Here is a link to the related code on jsfiddle

    <div id="footerwrap">
    <div id="footer">
        <div class="copyright">2014 - 2015 <span class="bar">|</span>www.website.com<span class="bar">|</span>Created by <a href="http://www.website.com" target="_blank">website</a><span class="bar">|</span>
            <ul>
                <li><a href="https://www.facebook.com" target="_blank" title="Facebook"><img src="http://www.commuwise.nl/wp-content/uploads/facebook.png" /></a>
                </li>
            </ul>Like us on Facebook!</div>
    </div>
</div>

CSS:

    #footerwrap {
    width: 1000px;
    float: left;
    margin: 0 auto;
    clear: both;
}
#footer {
    height: 30px;
    background: #33FF66;
    border-radius: 10px;
    border: 1px solid #1feb52;
    margin: 0px auto;
    text-align: center;
    color:#FFF;
}
#footer a {
    color:#FFF;
    text-decoration:none;
}
#footer a:hover {
    color:#FFF;
    text-decoration:underline;
}
#footer a:visited {
    color:#FFF;
    text-decoration:underline;
}
.bar {
    font-size: 15px;
}
#footer .copyright ul {
    list-style: none;
    margin: 0px 0px 0px;
    padding: 3px;
    float:right;
    margin-left:5px;
}
#footer .copyright img {
    border: 0px;
}
#footer .copyright {
    color: #fff;
    line-height: 32px;
    margin-left: 5px;
    margin-top: 0px;
    text-align: center;
}

Thank you in advance for your help!

Answer №1

Check out this jsFiddle example: http://jsfiddle.net/DSrn4/1/

If we look at your CSS code,

#footer .copyright ul {
    list-style: none;
    margin: 0px 0px 0px;
    padding: 3px;
    display:inline-block;
    margin-left:5px;
}

We made the following adjustments:

  • Removed: float:right;
  • Added: display:inline-block;

Answer №2

Check out this jsfiddle

<div id="footerwrap">
   <div id="footer">
        <div class="copyright">
    2014 - 2015 <span class="bar">|</span>www.website.com<span class="bar">|</span>Created by <a href="http://www.website.com" target="_blank">website</a><span class="bar">|</span>Follow us on Twitter!<a href="https://www.twitter.com" target="_blank" title="Twitter"><img src="http://www.commuwise.nl/wp-content/uploads/twitter.png" /></a>

        </div>
    </div>
</div>

Answer №3

Do you like the way this is set up? View Fiddle

#footer .copyright ul {
list-style: none;
margin: 0px 5px;
padding:0 3px;
float:right;
}
#footer .copyright ul li a{
display:block;
margin:0;
padding:0;
}
#footer .copyright ul li a img{
display:inline-block;
vertical-align:top;
padding-top:3px;
}

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

"By clicking on the image, you can trigger the transfer of data to the view.py file

Check out my image in two.html: https://i.sstatic.net/FhKlz.png <td> <img src="http://127.0.0.1:8000/imageAll/101.png" width="100"; height="300"> </td> I need to pass the data value of 101 to my view.py wh ...

Styling menus with CSS

I'm struggling with a CSS issue while attempting to add a 1px solid black line after each element in my drop-down table menu. The current appearance of my menu is causing some trouble. What I desire for it to look like involves applying border: 1px s ...

Aligning a set of list items horizontally within an unordered list is a great way to maintain a clean

I'm struggling with centering the alignment of li elements within a ul. Below is the excerpt from my code: ul.nav { width: 1000px; margin: 0 auto; list-style-type: none; } .nav li { float: left; width: 300px; } #government { clear: left ...

Is there a way to make a table row clickable? I tried finding solutions online, but none of them seemed to work for me

Having trouble opening a new page when tapping on a cell (TR) using Javascript. Despite trying various online tutorials, I still can't get it to work properly. Any assistance would be greatly appreciated. Thank you. Below is the code snippet: fun ...

What is the best way to create space between these form boxes for padding?

I am struggling to align two form boxes on the same line and another one below them. Despite my attempts with divs, I cannot seem to separate these two fields. I even tried inserting the   character between them, but to no avail. Below is the snippet ...

How can the top height of a jquery dialog be reduced?

Just starting out with jquery, I've got a dialog box and I'm looking to decrease the height of this red image: https://i.sstatic.net/BuyQL.png Is there a way to do it? I've already made changes in the jquery-ui.css code, like so: .ui-dia ...

What is the best way to set up the correct pathway for displaying the image?

I'm currently facing a challenge with displaying an image from my repository. The component's framework is stored in one library, while I'm attempting to render it in a separate repository. However, I am struggling to determine the correct p ...

Increase the height of the div element by a specified number of

Is there a way to dynamically expand a div's height using CSS without knowing its initial height? I want to increase the height by a specific amount, such as "x px taller" regardless of its starting size. For example, if the div starts at 100px tall, ...

Adjust the initial slider according to the values displayed in the following four sliders

Having an issue updating the slider value in the first one based on selected values from four other sliders. The selected value should not exceed 50, which is the maximum value in the first slider. Link to Working Fiddle : Below is the HTML code : & ...

Troubleshooting: CSS calc function not functioning properly in Firefox

My goal is to dynamically adjust the widths of td elements in my table. This functionality works smoothly in Chrome and Safari, but not in Firefox. Check out the fiddle here Here is the HTML structure: <table border="0" cellspacing="0" cellpadding="0 ...

Issues with Font-Face Implementation

Hey there! I'm currently working on incorporating a new font into my website using font-face. However, it seems like something might be missing from my code because the style isn't being applied correctly. Here is what I have so far: <div id= ...

Choose the span element that is contained within multiple div elements

Is there a way to target a specific span tag and change the text color to white without using IDs? I am trying to modify the CSS of the friend section on a page but cannot add any IDs. This is for the friend section on the website younow. <div id="left ...

What is the best way to add custom styles to Material UI tabs in a React application?

I need help styling my material UI tabs within a react component. I am having trouble getting the styles applied correctly, specifically setting the background color and box shadow of the entire bar, as well as defining the indicator background color and u ...

Positioning an anchor element over an image in Internet Explorer (IE)

Encountering an issue with IE9 (and 8) involving the positioning of empty anchor elements over an image. The anchors contain text, which is pushed off the page using CSS's text-indent property. Currently working on a website with promo panels display ...

How can I create a drop-down list in Bootstrap 4 input?

Displayed below is an example of a customized button dropdown featuring material icons and the Google Roboto Mono font, ideal for optimal spacing. My inquiry pertains to replicating this behavior with an input field. <!-- Bootstrap CSS --> < ...

Element is not being overlapped by higher z-index

#navbarContentHamburger { background-image: url(../img/657904-64.png); background-size: contain; z-index: 3; position: fixed; width: 22px; height: 20px; top: 7.7px; left:8px; } .open { width: 4% !important; transiti ...

Responsive Material-UI horizontal navigation bar

Hey there! I'm working on developing a UI using Material-UI, and I want to make it so that the menu can be collapsed into a slide-in style menu when accessed on a mobile device. Currently, I'm using tabs which allow for sliding left and right, b ...

Web Development using HTML and JavaScript

Here is the code for a search bar engine that I am working on. <form id="frmSearch" class="search1" method="get" action="default.html" /> <input class="search" id="txtSearch" type="text" name="search_bar" size="31" maxlength="255" value=" ...

Flexible Box Model Parent with Children Having Full Height

I'm currently developing an application featuring a custom calendar that utilizes Flexbox for styling, with all the date logic being managed by React. While the calendar is working perfectly fine, I've encountered a styling issue that has me stu ...

Switching Bootstrap Navbar Active State with JavaScript

I have encountered an issue with using the "active" class on my navbar navigation items in Bootstrap 4. When I click on the links, the active state does not switch as intended. I have tried incorporating JavaScript solutions from similar questions but have ...