Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Why "clear" property is not working for me ?!
Old 07-15-2009, 11:05 PM Why "clear" property is not working for me ?!
!dahan!'s Avatar
Average Talker

Posts: 20
Trades: 0
My following question maybe basic for many but it
seems i do not know how to work with the "clear" property.
I expected the following code to place the box "This is "first"div"
at the right-top corner of my page and the other box:
"this is "second" div" at its' left side and beneath the "first" box.

Code:
<title>Learn How to clear</title><style type="text/css"> div.second { border:3px solid #ff9900; width:120px; float: left; } div.first { border:3px solid #FF00FF; width:120px; float:right; clear:left; }</style></head><body><div class="first">This is &quot;first&quot;div</div><div class="second">This is &quot;second&quot; div </div>
Evantualy, "first" was placed at the top right corner of that page
and "second" at the top left corner but at the same row !

Can anyone explain me why "first" remains at the same row with "second"
Despite "clear:left" was assigned to it ?
Thanks a lot
__________________

Please login or register to view this content. Registration is FREE
!dahan! is offline
Reply With Quote
View Public Profile Visit !dahan!'s homepage!
 
 
Register now for full access!
Old 07-16-2009, 12:22 AM Re: Why "clear" property is not working for me ?!
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
They are both be on the same line because there is no clearing done in between those two divs to reset the normal flow of the document.

When I was learning css and floats I made nice bold colors for backgrounds and moved stuff around on the page. It really helped to "see" where the boundaries of things with padding and margins actually were as opposed to some white text on a white page.

Try adding <div class="clear"></div> between those and in css .clear {clear:both;}

http://css-tricks.com/all-about-floats/
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Reply     « Reply to Why "clear" property is not working for me ?!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33718 seconds with 12 queries