Alternative to layout in HTML
前端 未结 5 1136
忘了有多久
忘了有多久 2021-02-04 07:48

Right now I have a webpage set up to be exactly the size of the browser window with a couple overflow:scroll \'s in it.

Basically, the page is arranged in t

5条回答
  •  -上瘾入骨i
    2021-02-04 08:23

    Thanks for the link, that explains a lot. Sounds familiar, I've done this before, but it can be pretty tricky.

    Before explaining the lot, I need to know whether you want to support IE6 with this. If so, you'll probably have to revert to IE quirks mode, as you will need the border-box box model (which can't be selected in another way in IE, and it's not possible to use both top and bottom properties). If so, I recommend to put all other browsers in this box model, too, so you don't have to make two separate stylesheets for IE and the rest (yes, you'll still need some workarounds, of course). In short, after using this different box model you can have quasi top and bottom properties by styling using border-top and border-bottom, instead. They'll act like top and bottom, because they're now inside the given height (of, for instance, 100% of the viewport). I hope this is at least a bit understandable.

    If not, than it's a bit simpler and you can style using fixed positioning and

    getting top and bottom properties. IIRC, this should also work in IE7+.

    But first, tell me whether you need support for the buggy one or not...

提交回复
热议问题