Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2009, 03:37 PM   PM User | #1
Duffman12
Regular Coder

 
Join Date: Oct 2005
Posts: 124
Thanks: 7
Thanked 0 Times in 0 Posts
Duffman12 is an unknown quantity at this point
floats not pushing borders of divs?

See http://mikelambert.me/floatdiv.htm

So I'm trying to float an element to the right of a bunch of text on the screen. The float is making the text wrap, as expected. I have a border on the top of the titles, but the float isn't making the actual div smaller. Its just making the text in the div wrap. The title border-top is going right through the float.

How can I make the float make the div smaller so my title borders stop before the float?

The same problem is effecting the margin-right of the <p>'s (lorem).

Last edited by Duffman12; 11-20-2009 at 03:40 PM..
Duffman12 is offline   Reply With Quote
Old 11-20-2009, 03:56 PM   PM User | #2
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,817
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Apply a margin-right to .title page equivalent to the width of the floated elements plus borders.
SB65 is offline   Reply With Quote
Old 11-20-2009, 04:02 PM   PM User | #3
Duffman12
Regular Coder

 
Join Date: Oct 2005
Posts: 124
Thanks: 7
Thanked 0 Times in 0 Posts
Duffman12 is an unknown quantity at this point
I've updated http://mikelambert.me/floatdiv.htm

Applying the margin-right will only work for the .titles that are next to the div. Look at the titles that are below the float, I want that one to go all the way across.
Duffman12 is offline   Reply With Quote
Old 11-20-2009, 04:15 PM   PM User | #4
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,817
Thanks: 9
Thanked 681 Times in 675 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Well, a very simple solution would be to apply a background-colour to the floated div - but maybe that won't work with your design?
SB65 is offline   Reply With Quote
Old 11-20-2009, 04:19 PM   PM User | #5
Duffman12
Regular Coder

 
Join Date: Oct 2005
Posts: 124
Thanks: 7
Thanked 0 Times in 0 Posts
Duffman12 is an unknown quantity at this point
yeah, currently, the floated div has a separate background color than the regular background. So the title borders go all the way up to the floated div and stop. I want it to have some sort of margin.

That's a good idea though. If there really isn't a way to get the title divs to shrink, i can make the floated div the same color as the background, then embed a separate div inside the floated one and apply my styles to that. Kind of a hack, but it'll work...
Duffman12 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 04:47 AM.


Advertisement
Log in to turn off these ads.