OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

float:left changes width of div

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets and Accessibility >> float:left changes width of div
Page: [1]
 
Rin

 

Posts: 7
Joined: 10/24/2008
From: The end of the line
Status: offline

 
float:left changes width of div - 10/24/2008 5:10:12   
Hello everyone!

I've gotten myself stuck, and I was hoping somebody here could help me.

I have a page who's 'main' section of the body is divided into 2 parts, the content on the left, and a side bar on the right (common layout). However, I cannot get the sidebar to sit next to the content unless the side bar comes before the content in the HTML; which I would like to avoid for accessibility reasons. The only other option I am aware of is to have the content section floated as well. I have tried this, but when I add float:left to the style sheet the div floats, but the width of the div also changes.

I only have access to FF at the moment, so I don't know how it is behaving in other browsers.

Also, using FireBug, I have cut out all of the extra rules from parent tags, and it doesn't have any effect on the problem.

So there is my problem, and my question is:

Is there a way to counter this, without setting a specific width for the div's?

heres a link if you need it (it's no where near finished):
http://www.afbu.org/theme.html
Tailslide

 

Posts: 6692
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: float:left changes width of div - 10/24/2008 6:31:37   
If you're floating a div then you MUST set a width for it. You can however use % insead of PX or EMs if you prefer.

If you fail to set a width for a float (unless it's implicit i.e. a photo) then some browsers will shrink the div to fit the content - which sounds like what's happening to you - others will take a wild guess... not a good thing!

I'd go for floating both and giving both a width in % - it's the most reliable way.

_____________________________

Little Blue Plane Web Design | Land Rover project

:)

(in reply to Rin)
Rin

 

Posts: 7
Joined: 10/24/2008
From: The end of the line
Status: offline

 
RE: float:left changes width of div - 10/24/2008 10:09:10   
Thank you,
I thought it defaulted to 100% of it's parent, and based on that I was trying to use margins to set make space for them to sit side by side.

(in reply to Tailslide)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets and Accessibility >> float:left changes width of div
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts