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
Bottom border getting messed up by float:left
Old 11-24-2008, 02:43 AM Bottom border getting messed up by float:left
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Hi everyone. I am making a page that will output articles from a database. I am having the image with the article float left so that the text wraps the image and so that it goes to the left of the page. The problem is when I do this the <div> doesnt include the image and the bottom border is redrawn under the image if I dont have enough text to push it down. The text still wraps properly and the image is place correctly, the bottom border of the box surrounding the article just doesnt adjust correctly when I float it, but does when I have no float.

I have included some css code below, I think the problem is somewhere in there. Anyways help would be appreciated!

Code:
#page {
  clear: both;
  float: left;
  width: 100%;
  margin-bottom: 6em;
  text-align: left;
}
#columns {
  margin: 0 auto;
#textHolder {
border: 1px dashed gray;
margin-top: 10px;
height:auto;
padding-left: 5px;
padding-top:10px;
padding-bottom:10px;
}
}
.newsImage {
padding-right: 15px;
float:left;
}
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-24-2008, 06:43 AM Re: Bottom border getting messed up by float:left
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 8,936
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
clear: both; is done after the float; that is, after what you want to wrap around what is floated has.

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Old 11-24-2008, 06:52 AM Re: Bottom border getting messed up by float:left
Skilled Talker

Posts: 88
Trades: 0
yes serandfae is right

this is what you usually do:

#page {
float: left;
width: 100%;
margin-bottom: 6em;
text-align: left;
}
#columns {
margin: 0 auto;
#textHolder {
border: 1px dashed gray;
margin-top: 10px;
height;
padding-left: 5px;
padding-top:10px;
padding-bottom:10px;
}
}
.newsImage {
padding-right: 15px;
float:left;
}

.clr {
clear: both;
}

then in your code after your float eg:

<div id="page"></div>
<div class="clr"></div>
<p>hello world</p>

the clear will tell anything else after the clear goes on a new line whereas if you don't have it then it gets wrapped (floated) like the rest before it, so in my example p will be on a new line.
__________________
Graham Barnes


Please login or register to view this content. Registration is FREE
xpguy is offline
Reply With Quote
View Public Profile
 
Old 11-24-2008, 01:42 PM Re: Bottom border getting messed up by float:left
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Ok ya it worked. I put <div class="clear"></div> right after the text that I wanted wrapped. Too bad there wasnt another way though so I would need to have an empty div with nothing in it but oh well.

Thanks for the help.
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
Old 11-24-2008, 04:12 PM Re: Bottom border getting messed up by float:left
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
There most certainly ARE other ways to clear floats and I wouldn't use an empty div either. Read up on the other methods here:

http://css-discuss.incutio.com/?page=ClearingSpace
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 11-25-2008, 02:56 AM Re: Bottom border getting messed up by float:left
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
LadynRed I knew that if this thread kept going long enough you would come in with the perfect answer . Thanks.
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
Old 11-25-2008, 10:37 AM Re: Bottom border getting messed up by float:left
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Glad I could help. I was watching the thread, and you did get your answer, but that empty div for clearing just bugs me so I wanted to point out the alternatives
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Bottom border getting messed up by float:left
 

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.24609 seconds with 12 queries