开发者

minimizing browser window affects the page style

I designed a web page using CSS/HTML. I gave all the divs an absolute position property,and used % instead of px for all the dimension. My problem is that minimizing the browser window make开发者_C百科s my divs interferes,change them size,and looks messy.

I added the "DOCTYPE" tag and meta tags. I thought there is something wrong with the position property so i tried "relative",and "static" instead of "absolute" but nothing changed.

what can i do??


I take it your are new to HTML/CSS, as you should ALWAYS have a DOCTYPE or your code will most defiantly not be valid and will break cross browser.

Using absolute on everything isn't recommended, by myself or anyone else. But you could add a wrapper div around your page, set it to relative and that might help then you wouldn't have to recode your page to fix this issue. But then again, it might not do much at all without your code or an example there is really no way to tell.


Using absolute positioning for everything will do exactly that. Keep everything static unless you really need AP, and when you use AP make a parent element or grandparent of the AP element position relative so you have a base to position off of.


When you resize the browser window, the width and height change, thus your relative positions change and break your layout. The rule of thumb is: do not use absolute positioning unless it's unavoidable. Use the standard document flow and floats where possible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜