What are the bad and good points of usin css positioning over Float+margin+padding?
Can we make cross browser css l开发者_如何学编程ayouts with CSS positioning, without using float? What are the bad and good points of usin css positioning over Float+margin+padding? I want to make layout compatible with all A-Grade Browser and with IE6 Also? IN dreamweaver we have a layer functionaliy to make css layout quickly but it's uses absolution position. is this technique bad?
If you don't care how it looks if the browser is larger or smaller than you designed for then absolute positioning it great. :)
But, in most cases, if you are designing for a browser that may be on a 17" - 30" monitors, so it may be fullscreen, then float is helpful.
Now, if you are changing the positions to scale to the size of the window dynamically, and can handle a resize, then absolute will work well.
I think absolute positioning would be more work than it is worth, if you want to get rid of float.
When I put together a page, I consider the elements I am putting together and the kind of physical structure they form. If elements are lined up together, like a row of books, I will use floats to "press" them up against one another. If I have more sparse elements, like post-it notes on a sheet of paper, I will use absolute positioning because the position of one element is not closely tied to the position of another.
I also look at what I know about the elements and what I don't. If I have things that change in size, like elements with varying amounts of content in them, I will use floats to position them. This way the elements still "stack" up together in some orderly fashion. Positioning an element of arbitrary size can be tricky, since you can end up exceeding a container's boundaries and breaking a layout or displaying/hiding some content in a place you don't want it.
Of course, you can combine the two techniques together, too - it's all about what you need to put together.
Can we make cross browser css layouts with CSS positioning, without using float?
Certainly, if you like. Floats and positioning are just two more CSS properties, they are not mutually exclusive. For complex layouts you may often be mixing both.
IN dreamweaver we have a layer functionaliy to make css layout quickly but it's uses absolution position. is this technique bad?
Yes. Except for things that are naturally fixed-size like images, using exact page-pixel absolute positioning is a bad move, one that automated tools tend to produce because it's easy to do with a WYSIWYG interface but one which degrades badly for text.
精彩评论