HTML 'td' 宽度和高度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12881067/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:22:10 来源:igfitidea点击:
HTML 'td' width and height
提问by Shane Hsu
The 'height' and 'width' are not supported in HTML5. How can I set a td's width and height while conforming to the HTML5 standard?
HTML5 不支持“高度”和“宽度”。如何在符合 HTML5 标准的同时设置 td 的宽度和高度?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>219 班網</title>
</head>
<body bgcolor="silver">
<div align="center">
<table>
<tr>
<td width="1000" height="250">
<object width="100%" height="100%" data="frameTop.html"></object>
</td>
</tr>
</table>
<table>
<tr>
<td width="300" height="700" >
<object width="100%" height="100%" data="frameLeft.html"></object>
</td>
<td width="700" height="700">
<object width="100%" height="100%" data="frameRight.html"></object>
</td>
</tr>
</table>
</div>
</body>
</html>
回答by Ravindra Bagale
The width attribute of <td>
is deprecated in HTML 5.
的 width 属性<td>
在 HTML 5中已弃用。
Use CSS. e.g.
使用 CSS。例如
<td style="width:100px">
in detail, like this:
详细来说,像这样:
<table >
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td style="width:70%">January</td>
<td style="width:30%">0</td>
</tr>
<tr>
<td>February</td>
<td></td>
</tr>
</table>
回答by Sukumar
Following widthworked well in HTML5: -
以下宽度在 HTML5 中运行良好:-
<table >
<tr>
<th style="min-width:120px">Month</th>
<th style="min-width:60px">Savings</th>
</tr>
<tr>
<td>January</td>
<td>0</td>
</tr>
<tr>
<td>February</td>
<td></td>
</tr>
</table>
Please note that
请注意
- TD tag is without CSS style.
- TD 标签没有 CSS 样式。