javascript - 如何将我的整个 html 文件放在一个窗口中

标签 javascript html css python-3.x scrollbar

如何将我的整个 html 文件放在一个窗口中并去掉滚动条。 (换句话说:如何最小化 html 文件以在一个窗口中显示全部内容)。

我尝试添加 width = "100"但这会引发错误。

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <meta http-equiv="Content-Type"
          content="text/html; charset=%(charset)s" />
    <title></title>
    <style type="text/css">%(styles)s
    </style>
</head>

<body>
    %(table)s%(legend)s
</body>

</html>"""

_styles = """
        table.diff {font-family:Courier; border:medium;}
        .diff_header {background-color:#e0e0e0}
        td.diff_header {text-align:right}
        .diff_next {background-color:#E6E6FA}
        .diff_add {background-color:#aaffaa}
        .diff_chg {background-color:#ffff77}
        .diff_sub {background-color:#ffaaaa}"""

_table_template = """
    <table class="diff" id="difflib_chg_%(prefix)s_top" 
           cellspacing="0" cellpadding="0" rules="groups" >
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
        %(header_row)s
        <tbody>
%(data_rows)s        </tbody>
    </table>"""

_legend = """
    <table class="diff" summary="Legends">
        <tr> <th colspan="2"> Legends </th> </tr>
        <tr> <td> <table border="" summary="Colors">
                      <tr><th> Colors </th> </tr>
                      <tr><td class="diff_add">&nbsp;Added&nbsp;</td></tr>
                      <tr><td class="diff_chg">Changed</td> </tr>
                      <tr><td class="diff_sub">Deleted</td> </tr>
                  </table></td>
             <td> <table border="" summary="Links">
                      <tr><th colspan="2"> Links </th> </tr>
                      <tr><td>(f)irst change</td> </tr>
                      <tr><td>(n)ext change</td> </tr>
                      <tr><td>(t)op</td> </tr>
                  </table></td> </tr>
    </table>"""

图片: HTML output file

最佳答案

我猜你必须让你的 body 达到 100% 的窗口:

CSS:

body{
  margin:0;
  padding:0;
  width:100%;
  height:100vh;
  overflow:hidden; /* to hide scrollbar */
}

而且,我猜你必须在你的表格中添加 css 作为“width:100%”或者根据你想如何显示这两个表格。

关于javascript - 如何将我的整个 html 文件放在一个窗口中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51777196/

相关文章:

javascript - 无法在图像周围添加按钮

javascript - 强制 Meteor 更新远程更改?

html - 表格可以做什么 CSS 定位不能做什么?

html - Bootstrap 4 裁剪的修复

html - 具有任意水平规则的等宽表格标签

javascript - 为什么我无法使用 Bootstrap 的大模态和/或小模态?

javascript - splice() 无法正常工作

html - 如何增加 HTML5 输入类型范围的长度/大小

css - 仅当包含内容时才使用相对高度设置 div 的背景样式

javascript - 如果为空值,则引发输入工具提示