Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 定义表格宽度&;CSS中的高度,因此打印时具有特定的宽高比_Html_Css_Printing_Html Table - Fatal编程技术网

Html 定义表格宽度&;CSS中的高度,因此打印时具有特定的宽高比

Html 定义表格宽度&;CSS中的高度,因此打印时具有特定的宽高比,html,css,printing,html-table,Html,Css,Printing,Html Table,我在我的网页上有一个表格,它使用了一个特定的打印CSS,删除了所有的网站元素,以便可以打印在海报上 我所做的是: 使用Google Chrome访问页面 单击:文件->打印->“使用系统对话框打印…” 单击PDF->“另存为PostScript”,然后 使用Adobe蒸馏器(150 dpi和18“x 24”)进行处理 既然我希望我的桌子能很好地填满18英寸x24(18/24=3/4)的海报,那么我如何确保它的宽/高纵横比是3/4,而不加入可能会让我难以打印的特定尺寸呢,我想到的唯一解决方案是,你

我在我的网页上有一个表格,它使用了一个特定的打印CSS,删除了所有的网站元素,以便可以打印在海报上

我所做的是:

  • 使用Google Chrome访问页面
  • 单击:文件->打印->“使用系统对话框打印…”
  • 单击PDF->“另存为PostScript”,然后
  • 使用Adobe蒸馏器(150 dpi和18“x 24”)进行处理

  • 既然我希望我的桌子能很好地填满18英寸x24(18/24=3/4)的海报,那么我如何确保它的宽/高纵横比是3/4,而不加入可能会让我难以打印的特定尺寸呢,我想到的唯一解决方案是,你必须用另外两个
    div
    s来包装表格

    这是

    正如我们所说,我正在努力改进解决方案,以摆脱div

    目前,我正在使用一个div作为宽度设置为100%的
    包装
    ,然后在其中有另一个div(
    innerWrapper
    ),它绝对定位并扩展到
    包装
    的维度。为了设置div的高度,我使用了一个简单的技巧-在
    包装器
    之后添加一个伪
    :元素,该包装器的
    填充底部
    设置为133%。填充百分比值是从父级的
    宽度继承的(是!)。如果有人问-我们不能使用
    innerWrapper
    div并将其样式直接设置为
    table
    ,因为
    top、right、bottom、left
    方法对它不起作用(宽度和高度也不能设置为
    100%
    )。div是
    元素,表具有
    显示:表

    整个代码如下所示:

    HTML

    <div id="wrapper">
        <div id="innerWrapper">
            <table></table>
        </div>
    </div>
    
    #wrapper {
        width:100%;
        position: relative;
    }
    #wrapper:after {
        content: "";
        display: block;
        padding-bottom: 133%;
    }
    #innerWrapper {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
    table {
        width: 100%;
        height: 100%;
    }
    

    目前,我想到的唯一解决方案是,您必须在表中添加两个
    div
    s

    这是

    正如我们所说,我正在努力改进解决方案,以摆脱div

    目前,我正在使用一个div作为宽度设置为100%的
    包装
    ,然后在其中有另一个div(
    innerWrapper
    ),它绝对定位并扩展到
    包装
    的维度。为了设置div的高度,我使用了一个简单的技巧-在
    包装器
    之后添加一个伪
    :元素,该包装器的
    填充底部
    设置为133%。填充百分比值是从父级的
    宽度继承的(是!)。如果有人问-我们不能使用
    innerWrapper
    div并将其样式直接设置为
    table
    ,因为
    top、right、bottom、left
    方法对它不起作用(宽度和高度也不能设置为
    100%
    )。div是
    元素,表具有
    显示:表

    整个代码如下所示:

    HTML

    <div id="wrapper">
        <div id="innerWrapper">
            <table></table>
        </div>
    </div>
    
    #wrapper {
        width:100%;
        position: relative;
    }
    #wrapper:after {
        content: "";
        display: block;
        padding-bottom: 133%;
    }
    #innerWrapper {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
    table {
        width: 100%;
        height: 100%;
    }