简体   繁体   English

CSS 三栏布局

[英]CSS three-column layout

I'm looking for the best way to accomplish the following layout.我正在寻找完成以下布局的最佳方法。 I need to accommodate a header and footer of varying size, of which I am not in control.我需要容纳一个 header 和不同大小的页脚,我无法控制这些。 In between those elements, I need to set up a fixed three column layout.在这些元素之间,我需要设置一个固定的三列布局。 The total layout needs to always print on one standard page in landscape mode.总布局需要在横向模式下始终打印在一个标准页面上。 If I didn't have to allow for the header/footer, I know I could just use a fixed layout... but I can't.如果我不必允许页眉/页脚,我知道我可以使用固定布局......但我不能。 The layout needs to be:布局需要:

variable height header可变高度 header
div with three fixed width columns具有三个固定宽度列的 div
variable height footer可变高度页脚

ps sorry, don't yet know the proper way to display this graphically here:( ps 抱歉,还不知道在此处以图形方式显示此内容的正确方法:(

If you're looking to have text divided into three columns, for a treat, you could try CSS3's columns:如果您希望将文本分成三列,作为一种享受,您可以尝试 CSS3 的列:

This however, is not supported in older browsers.但是,旧版浏览器不支持此功能。

If you want to control how your page prints, use the @page rule, like this:如果要控制页面的打印方式,请使用 @page 规则,如下所示:

<html>
    <head>
        <style type="text/css">
            @page
            {
                size:portrait;
                margin:1in;
            }
        </style>
    </head>
    <body>...</body>
</html>

More info on @page can be found on the W3C's CSS 2 spec .有关@page 的更多信息,请参阅 W3C 的CSS 2 规范

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM