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

What is the best way to connect multiple web pages together?

Hello everyone, I could really use some assistance with a problem I'm facing. As a newcomer to web development, I have a question about navigation bars. I've successfully created a basic webpage with a navigation bar, but now I'm unsure how ...

p5.js experiencing issue: Uncaught TypeError - Unable to access property 'transpose3x3' due to null value

I have a simple website built with Flask where I am running several p5.js sketch animations, and everything is working smoothly. However, when I try to add a new sketch that utilizes WEBGL, I encounter the following error: Uncaught TypeError: Cannot read p ...

Using Jquery to toggle classes between "display block" and "display none

Hello friends, I'm in need of some help with my code. $(document).ready(function() { var circle = $('.circle'); $(".send a").click(function(e) { e.preventDefault(); $('.wrap').css('display', 'bl ...

Tips for rotating and positioning an element in the top left or top right corner of a page

I recently tried rotating a div with text and wanted to position it at the top left corner. I was able to successfully align it at the top, but I'm having trouble getting it to align with the left edge. Any tips on how to achieve this? .credit { ...

The functionality of the delete button in Datatables is only operational on the initial page, failing to

My datatable is giving me trouble. The delete button in the action column only works on the first page, but not on the other pages. Here is the code for my delete button: <table id="example" class="table table-striped table-bordered" cellspacing="0" wi ...

Guide to retrieving a file stored locally with VueJS

Currently, I am working on an upload system and I want to provide users with a sample template. The template is stored locally in a subfolder within the assets directory. My goal is to access this template in my VueJS component and display a link to it on ...

What could be causing my CSS navigation toggle button to malfunction?

My attempt at creating a toggle button for tablets and phones seems to be failing. Despite the javascript class being triggered when I click the toggle button, it is not functioning as expected... https://i.stack.imgur.com/j5BN8.png https://i.stack.imgur. ...

Is there a way to customize the title on the Configuration Page within a Joomla Component?

Problem with updating string in Language File: COM_OHANAH_CONFIGURATION="Ohanah Konfiguration" I have tried adding the above string to the Language File, but it doesn't seem to reflect the changes. I have checked other Joomla Components and they all ...

arranging the divs based on the space allocation within the page

Is there a way to neatly organize the divs on a page, depending on available space? I want them to align horizontally if there is enough room before moving to the next line. The tab-content parent div may contain several divs. Any suggestions on how this c ...

Presenting a trio of distinct tables each accompanied by its own unique button option

I am attempting to create a functionality where there are 3 buttons and when a user clicks on one of them, it shows the corresponding table while hiding the other two. I have experimented with using getElementById to manipulate the display property of the ...

The ajax method for loading an xml file results in displaying the undefined message

When attempting to fetch content from an xml file using ajax, the page initially displays "undefined". However, upon refreshing the page, the content loads successfully. Take a look at my code snippet below: $.ajax({ type: "GET", url: "xm ...

Cannot Get jQuery .flip() to Work Automatically Every 2 Seconds

There are 3 words that I want to rotate on their x-axis every 2 seconds (repeating). Using jQuery: $(function () { count = 0; wordsArray = ["Innovation", "Creativity", "Success"]; setInterval(function () { count++; $("#words").text(wordsArray[co ...

What is the best way to include two class names within a single div using Next.js?

Struggling to include two different CSS classes into a single div element, I encountered some issues. For reference, here is a screenshot: https://i.stack.imgur.com/UuCBV.png https://i.stack.imgur.com/sHNwq.png My code snippet looks like this: blog.js ...

Ways to conceal a label and the input field when a radio input is switched on

In my HTML file, I have coded an application form using CSS to style it. Some of the tags have been removed for display purposes. <label>Member</label> <input type="radio" name="Answer" value="Yes"/>Yes<br/> <input type="radio" ...

Retrieving fresh CSS data from earlier animated elements within a Greensock timeline

In my code, I am using a TimelineLite() to perform a series of sequential tweens with .to(). What I want to achieve is accessing the output value from one of the early tweens in order to use it for constructing later tweens. Is there any way to retrieve t ...

How to automatically set a default bootstrap tab upon page load using an MVC JsonResult responseData

I'm looking to enhance the user experience on my dashboard by allowing users to set their preferred default tab view upon logging in. Using an AJAX call to retrieve the value from the database in MVC, I am working on the JS/Razor side of things to mak ...

Encountering an issue while attempting to replicate the Spotify app on localhost:3000. The error message "TYPEERROR: Cannot read property 'url' of undefined" is hind

As a first-time user of stackoverflow, I am unfamiliar with its rules and regulations, so I apologize in advance for any mistakes I may make. Currently, I am attempting to create a Spotify clone using React. Everything was going smoothly until I completed ...

Nested elements not transitioning using CSS

Why is my transition not being applied to the submenu <a> tag? The color change is working fine, but the transition does not occur on hover. When I use the same rules on another element with a different main class, it works perfectly. It seems like t ...

What is the best way to eliminate the alert message "autoprefixer: Greetings, time traveler. We are now in the era of CSS without prefixes" in Angular 11?

I am currently working with Angular version 11 and I have encountered a warning message that states: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js): Warning "autoprefixer: Greetings, time traveler. We are now in the era of prefix-le ...

Incorporating Admob into the Intel XDK platform

After creating a customized 2048 game app for Android with Intel XDK, I encountered difficulties when trying to integrate AdMob into my application. Lack of coding knowledge may be the reason behind my struggles. I have been using the original codes for th ...