Unordered list not floating properly - successful in JSFiddle but not displaying correctly in web browser despite updating Chrome and Firefox

Having trouble floating an unordered list? Check out this jfiddle example that aligns a list next to some text:

Here is the updated jfiddle link:

https://jsfiddle.net/8qzygaog/

I created a test document based on the example, but it's not working as expected. The list doesn't float in the correct position.

<!DOCTYPE HTML >
<html>
<head>

<style type="text/css">

 #footer-left { float:left; width:17em; border:0; border-top:1px dotted     #333; text-align:left; margin:0; padding:1.25em 0; }
.profile { width:1em; height:1em; margin-left:0.3em; }
#footer-left p { display:inline; font-size:.75em; color:#666; }
#footer-left ul { display:inline; margin:0; padding:0; float:left;}
#profiles li {  list-style:none; float:left; }

</style>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>

<div id="footer-left">
<p>E-mail me at <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eb868a8287ab8a878e9389999e85858e99c5888486">[email protected]</a><br />or visit my profiles at <ul id="profiles">
<li><a href="http://www.facebook.com/alexbrunner" target="_blank"><img src="../images/icons/16/facebook_bw.png" class="profile" alt="Facebook" /></a></li>
<li><a href="https://plus.google.com/u/0/109422064867262895187/about" target="_blank"><img src="../images/icons/16/googleplus_bw.png" class="profile" alt="Google plus" /></a></li>
<li><a href="https://www.xing.com/profile/Alex_Brunner7" target="_blank"><img src="../images/icons/16/xing_bw.png" class="profile" alt="Xing" /></a></li>
<li><a href="http://at.linkedin.com/in/abrunner/en" target="_blank"><img src="../images/icons/16/linkedin_bw.png" class="profile" alt="Linkedin" /></a></li>
</ul></p>
</div>
</body>
</html>   

Frustrating!

Answer №1

There are a few issues that need to be addressed.

Firstly, the code references #footer-right while the HTML actually specifies #footer-left.

Next, the HTML is incorrect as a paragraph p tag cannot contain a list ul.

To fix this, floats should be removed and replaced with inline-block.

 #footer-left {
   float: left;
   width: 17em;
   border: 0;
   border: 1px dotted #333;
   text-align: left;
   margin: 0;
   padding: 1.25em 0;
   overflow: auto;
 }
 .profile {
   width: 1em;
   height: 1em;
   margin-left: 0.3em;
 }
 #footer-left p {
   display: inline;
   font-size: .75em;
   color: #666;
 }
 #footer-left ul {
   display: inline-block;
   margin: 0;
   padding: 0;
 }
 #profiles li {
   list-style: none;
   display: inline-block;
 }
<div id="footer-left">
  <p>E-mail me at <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="204d41494c60414c4
    <br />or visit my profiles at</p>
  <ul id="profiles">
    <li>
      <a href="http://www.facebook.com/alexbrunner" target="_blank">
        <img src="../images/icons/16/facebook_bw.png" class="profile" alt="Facebook" />
      </a>
    </li>
    <li>
      <a href="https://plus.google.com/u/0/109422064867262895187/about" target="_blank">
        <img src="../images/icons/16/googleplus_bw.png" class="profile" alt="Google plus" />
      </a>
    </li>
    <li>
      <a href="https://www.xing.com/profile/Alex_Brunner7" target="_blank">
        <img src="../images/icons/16/xing_bw.png" class="profile" alt="Xing" />
      </a>
    </li>
    <li>
      <a href="http://at.linkedin.com/in/abrunner/en" target="_blank">
        <img src="../images/icons/16/linkedin_bw.png" class="profile" alt="Linkedin" />
      </a>
    </li>
  </ul>
</div>

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

Adaptive search bar and components housed within a casing

I am struggling to create a responsive box with a search feature for a mobile website. My plan is to incorporate jquery functions into the site, so I need to design an outer container that will house a distinct logo and search bar. However, when I test thi ...

Text that disappears upon clicking on show/hide按钮

Could someone please help me figure out how to prevent the "See more" text from disappearing when clicked in the example below? I want it to stay visible. Thank you! ...

Can Google Charts columns be customized with different colors?

Is it possible to modify the colors of both columns in Google's material column chart? Here is the code I am using for options: var options = { chart: { title: 'Event Posting', subtitle: 'Kairos event p ...

Modifying button text with jQuery is not feasible

I'm facing a challenge with jQuery and I need the help of experienced wizards. I have a Squarespace page here: . However, changing the innerHTML of a button using jQuery seems to be escaping my grasp. My goal is to change the text in the "Add to car ...

The functionality for selecting text in multiple dropdown menus using the .on method is currently limited to the first dropdown

Having trouble selecting an li element from a Bootstrap dropdown and displaying it in the dropdown box? I'm facing an issue where only the text from the first dropdown changes and the event for the second dropdown doesn't work. <div class="dr ...

What is the best method for automating the transfer of data from a database to the user interface of a website using html and javascript?

As a volunteer coordinator for a non-profit organization, I have some basic experience working with Python. I am willing to dedicate fewer than 8 hours of learning time to my current project in order to automate certain tasks (or else I will do them manual ...

Create a layout consisting of two rows, each containing three blocks. Ensure that the layout is responsive by using only HTML and CSS, without relying

Hello there! I am looking to create a responsive layout without using bootstrap or any other framework..... I want to build it from scratch. https://i.stack.imgur.com/GAOkh.png I am aiming for responsive blocks that collapse into one column when the page ...

What is the best way to adjust the footer width to match the sidebar using Bootstrap 5?

Currently working on a Bootstrap 5 template for my website, but being new to it makes it a bit challenging. Specifically struggling with aligning the footer to fit the full width of the sidebar. <!DOCTYPE html> <html lang="en"> <head&g ...

Setting the Height of a Fixed Element to Extend to the Bottom of the Browser Window

I currently have a webpage layout featuring a header at the top, a fixed sidebar on the left side, and main content displayed on the right. A demo version of this layout can be viewed at http://jsbin.com/iqibew/3. The challenge I'm facing is ensuring ...

Ensure that the content fills the entire height of the container and include a scrollbar

I'm currently utilizing CKEditor () and have developed my own customized file browser. The issue I'm encountering is that when the filebrowser is opened, it appears in a new popup window without scrollbars. I reached out for support through a ti ...

Troubleshooting: Instagram API JavaScript Example Showing Errors

I'm currently working on integrating a photo feed from my Instagram account by following this tutorial: Below is the snippet of my HTML code with the addition of instafeed.min.js: <!DOCTYPE <!DOCTYPE html> <html> <head> < ...

Combination of AngularJS and jQuery

I have a page in which additional input fields are dynamically added based on the selection made in a drop-down menu. This page is powered by angularjs, but I had to use jQuery specifically for adding these extra input fields. Here is the HTML code snippe ...

What is the best way to add a media query to a <style> element?

I have implemented Skrollr for my Parallax animations, allowing me to use Parallax keyframes without writing them inline. To make the plugin utilize external stylesheets for the keyframes, it uses AJAX to locate the stylesheets imported via <link>. ...

What is the process for extracting specific elements from a JSON object and incorporating them into a SELECT dropdown as options?

My json file contains a wealth of information. Here is a snippet: { "ListProductsResponse": { "Products": [{ "VatAmount": 0, "VatFormat": "Percent", "Bonus": { "AdditionalValue": 0, ...

What is the best way to place multiple images on top of one another within a single div, and make them break apart with animation upon hovering?

HTML: <div class="mySlides"> <img src="1.jpg"> <img src="2.jpg"/> <img src="3.jpg"/> <img src="4.jpg"/> <img src="5.jpg"/> </div> CSS: .mySlides { padding-top: 25%; padding-left: 5%; ...

Reduced resolution decreases image size significantly (bootstrap-5 Fluid)

What's Currently Happening: While using the Chrome browser's device toolbar tool to test my site at various resolutions, I observed that when I shrink the device screen to "Mobile-s" 320px, the content on my page becomes nearly unreadable. Additi ...

Utilizing jQuery to add a class to an element when a different one is hovered above

I'm currently working on implementing effects on the edges of a webpage that will be triggered when a central div is hovered over. The main tool I'm using for this task is jQuery. Despite my efforts to diagnose the issue by using alerts in my Ja ...

Updating a specific row in a table using PHP and SQL

I am having an issue with updating rows in a table that pulls information from a database. Each row has an input tag labeled COMPLETE, which the user can click on to update the database by changing a boolean field from 0 to 1. However, I am facing a prob ...

Tips for ensuring the footer remains at the bottom of the page

I'm struggling with positioning my footer at the bottom of the page. No matter what I try, it just doesn't look right. Here's the code snippet I've been working with: <div id="footer"> <div class="container"> <div ...

Unable to hide the mobile menu button

I am currently working on a fun website project . I am facing an issue with the mobile menu button not disappearing using display:none in Safari on my iPhone when in landscape mode, even though it works fine in Chrome. My goal is to make the #menu-button ...