如何将此表格放到文档的中心? [英] How do I bring this table to the center of the doc?

查看:74
本文介绍了如何将此表格放到文档的中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< table style =border:1px solid margin-left:20px; margin-right:20px; width:60%; background-color:#b0e0e6;>

< tr>



< td width =10%>

< b> I Rock< / b>

< br>< i> IN< / i>

< br>< / td>

< td width = 20%>

< ul>

< li>是的

< li>是的

< li>是的

< / ul>

< / td>







< / tr>

< / table>

<table style = "border:1px solid margin-left:20px; margin-right: 20px;width: 60%; background-color: #b0e0e6;">
<tr >

<td width="10%" >
<b>I Rock</b>
<br><i>IN</i>
<br></td>
<td width="20%">
<ul>
<li> yeah
<li> yeah
<li> yeah
</ul>
</td>



</tr>
</table>

推荐答案

这真的不是很显而易见的事情。



首先,尽量不要使用样式属性,使用CSS。这就是你的问题的解决方法:

This is really not a very obvious thing.

First of all, try not to use style attributes, use CSS. This is how your problem is solved:
table { margin-left: auto; margin-right: auto; /* remove other margin attributes */ }





查看其他款式,删除所有宽度和其他 margin 属性,切换到内容宽度定义的宽度,使用填充样式属性。如果您有其他表格与其他布局,请引入 class =center并将属性类名称更改为,例如, table.center





Review other styles, remove all width and other margin attributes, switch to widths defined by content width, use padding style properties. If you have other tables with other layout, introduce class="center" and change the property class name to, say, table.center.

table.center { margin-left: auto; margin-right: auto; /* ... */ }



HTML:


HTML:

<table class="center"> <!-- ... -->
</table>





-SA


这篇关于如何将此表格放到文档的中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆