日期:2014-05-17  浏览次数:20528 次

怪问题 td的innerText会影响style???
===========================第一种情况===========================
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>
<body>
<form   id= "form "   name= "form "   method= "post "   action= " ">
    <table   width= "575 "   align= "center ">
        <tr>
            <td   style= 'border-bottom-color:#000000;border-bottom-width:1px;border-bottom-style:solid;display:block; '> </td>
        </tr>
    </table>
</form>
</body>
</html>
===========================第二种情况===========================
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>
<body>
<form   id= "form "   name= "form "   method= "post "   action= " ">
    <table   width= "575 "   align= "center ">
        <tr>
            <td   style= 'border-bottom-color:#000000;border-bottom-width:1px;border-bottom-style:solid;display:block; '> 111 </td>
        </tr>
    </table>
</form>
</body>
</html>
====================================================================
第一种就不会显示td的样式,第二种就会显示td的样式   问题出现在哪呢?

------解决方案--------------------
没有内容。
td默认是高度为0[猜测]
------解决方案--------------------
本来昨晚就回帖了,不过回帖的页面短路了~现在回~~~


楼上说的对~~
无内容就被认为是无大小了,如果指定它的大小,就能看得到了~~~

而在table元素制定了width属性,无内容那么height被认为是零,所以也没东西看了~~

<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<form id= "form " name= "form " method= "post " action= " ">
<table width= "575 " align= "center ">
<tr>
<td style= 'background-color:#123456;height:50px;border-bottom-color:#000000;border-bottom-width:1px;border-bottom-style:solid;display:block; '> </td>
</tr>
</table>
</form>
</body>
</html>
------解决方案--------------------
添加 &nbsp;
------解决方案--------------------
记住Css中一句经典名言
没有前景就没有背景