3 replies [Last post]
aunus
aunus's picture
Offline
newbie
Last seen: 19 years 4 weeks ago
Joined: 2004-05-03
Posts: 2
Points: 0

I'm having a very annoying and simple problem. Sad Why following code does not work:

#Top 
{
  float : left;
  width : 100%;
  height : 50px;
  background-color : #ddeeff;  
}

#Top2 
{
  float : left;
  width : 100%;
  height : 50px;
  background-color : #ffeedd;  
}

#Box 
{
  position : absolute;
  top : 200px;
  left : 20px;
  
  border : 1px solid #000;
  padding : 10px;
}

HTML part:

<DIV ID="Top">
  Hello world!
</DIV>

<DIV ID="Top2">
  Hello world!!
</DIV>

<DIV ID="Box">
  Box
</DIV>

In Mozilla 1.6 and Opera 7.23 Everything works just fine. But in Internet explorer 6 I don't see the box at all!

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 4 years 30 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Two floats and absolute (IE 6)

Hi

Just add clear:both to the #box style

Trevor

aunus
aunus's picture
Offline
newbie
Last seen: 19 years 4 weeks ago
Joined: 2004-05-03
Posts: 2
Points: 0

Two floats and absolute (IE 6)

Problem solved. Thanks!

rtm223
rtm223's picture
Offline
Enthusiast
Last seen: 19 years 2 weeks ago
Joined: 2004-05-18
Posts: 58
Points: 0

Two floats and absolute (IE 6)

Alternatively you could just remove the floats? What is the need for floating an element that is 100% width?

css layout tutorials - in depth layout tutorials for all you newbies D maybe even some stuff for you not-so-new-bies out there P