首页前端开发JavaScripthtml表格怎么设置行高

html表格怎么设置行高

时间2024-01-29 19:35:02发布访客分类JavaScript浏览1111
导读:收集整理的这篇文章主要介绍了html表格怎么设置行高,觉得挺不错的,现在分享给大家,也给大家做个参考。htML表格设置行高的方法:1、给tr或td元素设置height属性,语法“<tr height="行高值">”;2、利用st...
收集整理的这篇文章主要介绍了html表格怎么设置行高,觉得挺不错的,现在分享给大家,也给大家做个参考。

htML表格设置行高的方法:1、给tr或td元素设置height属性,语法“tr height="行高值"> ”;2、利用style属性给tr或td元素添加height样式,语法“tr style="height: 行高值; "> ”。

本教程操作环境:windows7系统、HTML5版、Dell G3电脑。

我们有下面一个表格:

table border="1">
    	tr>
    		th>
    商品/th>
    		th>
    价格/th>
    	/tr>
    	tr>
    		td>
    T恤/td>
    		td>
    ¥100/td>
    	/tr>
    	tr>
    		td>
    牛仔褂/td>
    		td>
    ¥250/td>
    	/tr>
    	tr>
    		td>
    牛仔库/td>
    		td>
    ¥150/td>
    	/tr>
    /table>
    

怎么设置这个表格的行高?

1、通过给tr或td元素设置height属性

table border="1">
    	tr>
    		th>
    商品/th>
    		th>
    价格/th>
    	/tr>
    	tr height="100">
    		td>
    T恤/td>
    		td>
    ¥100/td>
    	/tr>
    	tr>
    		td height="50">
    牛仔褂/td>
    		td>
    ¥250/td>
    	/tr>
    	tr>
    		td>
    牛仔库/td>
    		td>
    ¥150/td>
    	/tr>
    /table>
    

2、利用style属性给tr或td元素添加height样式

table border="1">
    	tr>
    		th>
    商品/th>
    		th>
    价格/th>
    	/tr>
    	tr style="height: 50px;
    ">
    		td>
    T恤/td>
    		td>
    ¥100/td>
    	/tr>
    	tr>
    		td style="height: 60px;
    ">
    牛仔褂/td>
    		td>
    ¥250/td>
    	/tr>
    	tr>
    		td>
    牛仔库/td>
    		td>
    ¥150/td>
    	/tr>
    /table>
    

相关推荐:《html视频教程》

以上就是html表格怎么设置行高的详细内容,更多请关注其它相关文章!

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!

html表格

若转载请注明出处: html表格怎么设置行高
本文地址: https://pptw.com/jishu/591507.html
html5中onclick是什么意思 html不常用的标签有哪些

游客 回复需填写必要信息