Previous Message
Next Message

Re: [css-d] Creating Adjacent Divs

Sent by Timothy J. Luoma on 9 December 2002 02:02


On Sun, 08 Dec 2002 17:40:38 -0800, Michael Ryznar [EMAIL-REMOVED]> 
wrote:

> What is the best way to position two divs beside each other 
> (horizontally)?

It depends.

The problem with float (other than browser bugs) is that it has to be first 
in the code.  'Position' might be better.... Remember that for non-CSS the 
code ends up in the way that you have it in the file itself.

However, if you can overcome that minor blip, it can be used well.

> float: left. This seems to work. The divs line up horizontally. (I clear 
> the effect by adding a clear: left to the next element). Is this the 
> proper way to achieve this effect?

Yes.


> The reason I ask, is I was looking at another book which mentions the
> "display: block" and the "display: inline" declarations

Not sure what you are talking about here... DIVs are display:block.

You need to set an explicit width with floated DIVs (and make sure they 
don't add up to 100% to avoid some browser bugs.

> I considered positioning the divs absolutely but that wouldn't work 
> because I would like the two divs to flow with the rest of the document 
> in the document flow.

Life is a series of balances and trade-offs... the trick is being well 
versed and well experienced enough to choose which is best

> The second part of my question is, if floats are the way to achieve 
> adjacent
> Divs, couldn't one theoretically layout a 3 column web site using 3
> containing divs set to float? Or are there pitfalls to this method?

One could theoretically created a 100 column web site using 100 floats.

http://www.thenoodleincident.com/tutorials/box_lesson/index.html

> Is it not a good idea to use floating divs for the main structure of a 
> layout?

Depends on who you ask.

TjL

-- 
Timothy J. Luoma
[EMAIL-REMOVED]
http://tntluoma.com


_______________________________________________
css-discuss [EMAIL-REMOVED]]
http://two.pairlist.net/mailman/listinfo/css-discuss
Sponsored by www.westciv.com - CSS resources | software | learning
Previous Message
Next Message

Message thread: