Jump to content

Why does this CSS code work?


adamcannon

Recommended Posts

I have three tables that are positioned (relative) 25px from each other.  The code below works fine for this purpose but I'm not sure why.  Precisely, why is div.right set to 50px instead of 25px?

 

div.left
{
clear:left;
float:left;
}

div.center
{
float:left;
position:relative;
left:25px;
}

div.right
{
float:left;
position:relative;
left:50px;
}

Link to comment
Share on other sites

You can also remove the "position:relative" elements and that first "clear:left".

 

If you are placing these divs in order, then they are already "relative".

 

The clear:left is then negated by the next command of float:left.

 

That's as if I used,

 

.widths {

width:300px;

width:500px

}

 

The last command always replaces the previous.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.