Welcome to WebmasterWorld Guest from 184.73.3.107

Forum Moderators: not2easy

Floating not working as expected

I can't believe I've never encountered this before

   
2:51 pm on Feb 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm experienced enough with CSS that I should know the answer to this. Maybe I'm just having a mind-block, but in any case, it's got me baffled. Here's the code:

<html>
<head>
<title>Float issue</title>
<style type="text/css">
#breadcrumbs {
font: 8pt/8pt normal verdana, arial, sans-serif;
padding: 3px;
margin: 0 10px 10px;
border: 1px solid #a9a9a9;
background: #dcdde9;
}
#sitemap {
float: right;
font-size: 7pt;
}
</style>
</head>
<body>
<div id="breadcrumbs">
<strong>You Are Here:</strong> Path > To > Current > Page
<a id="sitemap" href="sitemap.html">Site Map</a>
</div>
</body>
</html>

If you try the code, you'll see that the "Site Map" link is not being enclosed in the #breadcrumbs div. In Firefox, it's kind of half-in and half-out. In IE, it's all the way outside the border below the div.

I wanted it to be enclosed in the div, just like the rest of the text, but at the right-hand edge of it. This should be simple, and I should at least be able to figure out what's actually going on...maybe I'm just out of practice.

Thanks in advance,

Matthew

3:12 pm on Feb 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have any clearing applied for the floats anywhere?

Also, I know there are some who believe that a size won't matter, however, I always put a size on my containers that float.

3:16 pm on Feb 26, 2008 (gmt 0)

5+ Year Member



Shouldn't the link be before the other text so it will float to the right of it? It works correctly for me with that change.

<div id="breadcrumbs">
<a id="sitemap" href="sitemap.html">Site Map</a>
<strong>You Are Here:</strong> Path > To > Current > Page
</div>
3:35 pm on Feb 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shouldn't the link be before the other text so it will float to the right of it?

Duh! <slaps forehead> I knew I had a mindblock somewhere! Yes, you're right. Thanks for pointing that out! :)
12:30 pm on Feb 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I missed that one as well. I was looking at the css. Reminder to always view html code as well. :) Sorry about that MatthewHSE
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month