【发布时间】:2017-02-27 02:08:46
【问题描述】:
我正在尝试类似地设置两个表格的样式。但是,即使样式相同,两个表格的列宽也不同。第二个表格的第一列似乎有不可见的填充或间距。
document.getElementById('displayDateTime').innerHTML = Date();
html,
body {
height: 100%;
}
body {
margin: 0 auto;
max-width: 960px;
padding: 0 20px;
font-family: 'Roboto', sans-serif;
}
h1 {
font-size: 48px;
margin-bottom: 5px;
}
h2 {
font-size: 36px;
}
h3 {
font-size: 24px;
color: green;
}
table {
width: 100%;
}
pre {
font-family: 'Ubuntu Mono', monospace;
padding: 20px;
line-height: 1.5em;
}
.input {
background-color: lightgrey;
}
.lineno {
background-color: grey;
padding-right: 15px;
}
.output {
background-color: lightgrey;
padding: 20px;
line-height: 1.5em;
}
<div class="code-block">
<h2>Displaying Date & Time</h2>
<h3>Input</h3>
<table>
<tr>
<td>
<pre class="lineno">1<br>2<br>3</pre>
</td>
<td>
<pre class="input">
<script type="text/javascript">
document.getElementById('displayDateTime').innerHTML = Date();
</script></pre>
</td>
</tr>
</table>
<h3>Output</h3>
<table>
<tr>
<td>
<pre class="lineno">></pre>
</td>
<td>
<p id="displayDateTime" class="output"></p>
</td>
</tr>
</table>
【问题讨论】:
-
我认为这不适用于
table,因为您根本没有呈现表格数据。
标签: html css html-table css-tables