`

DHTML标签积累

阅读更多
TD的noWrap属性使用注意事项
☆提出问题:
<td width="28%" align="right" nowrap >
我设置nowrap和不设置nowrap效果都一样。就是表格随着文字自动伸展,为什么?
→回答问题:
TD元素noWrap属性的行为与TD元素的width属性有关。
◆如果未设置TD宽度,则noWrap属性是起作用的。
◆如果设置了TD宽度,则noWrap属性是不起作用的。
<html>
<head>
<title>wrap属性研究</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p>测试字符串:</p>
<p>我终于明白,我其实有一条韧性十足的命,它远比我想象中的那条命结实得多、耐磨的多……</p>
<p>单元格未设置nowrap属性的空表:</p>
<table width="100" border="1" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
</table>
<p>加入测试字符串:</p>
<table width="100" border="1" cellspacing="0" cellpadding="0">
<tr> 
<td>我终于明白,我其实有一条韧性十足的命,它远比我想象中的那条命结实得多、耐磨的多……</td>
</tr>
</table>
<p>单元格设置了nowrap属性,未设置width属性:</p>
<table width="100" border="1" cellspacing="0" cellpadding="0">
<tr>
<td nowrap>我终于明白,我其实有一条韧性十足的命,它远比我想象中的那条命结实得多、耐磨的多……</td>
</tr>
</table>
<p>单元格设置了nowrap属性,也设置了width属性:</p>
<table width="200" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="120" nowrap>我终于明白,我其实有一条韧性十足的命,它远比我想象中的那条命结实得多、耐磨的多……</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

http://www.blueidea.com/tech/web/2003/943.asp




IFrame只隐藏横向滚动条或者竖向滚动条
在子页面的<body>标签里加入以下格式:
<body style="overflow: auto; overflow-x:hidden">

有的人也会这样写:
<body style="overflow: scroll; overflow-x:hidden">

两个都可以实现隐藏横向滚动条;若要隐藏竖向滚动条,只需要将overflow-x改成overflow-y即可
让没有滚动条的某页面显示滚动条:
<body scroll="yes">

存在这样的结构:
<fieldset>
<s:div id="resultsDiv" theme="simple" cssClass="resultsDiv" cssStyle="width:100%;overflow-y:auto;overflow-x:hidden;" executeScripts="true" href="">
    <table class="clsResGridViewTblScroll" id="listMsgTable" width="100%;">
        <tr>
             <th nowrap align="center" width="5%">序号</td>
             <th nowrap align="center" width="80%">消息文本</td>
             <th nowrap align="center">日期</td>
        </tr>
        <s:iterator value="soiFeedBackMsgList" status="status" id="entity">
                  .
                  .
                  . 
        </s:iterator>
     </table>
</s:div>
</fieldset>
明明为div resultsDiv 指定了纵向的滚动条(auto指按需自动加滚动条),可是发现没有加上;改为overflow-y:scroll,有了滚动条,但是无法拖动,是不可用的。最后终于发现原因:没有指定height的div其高度是不确定的;table里数据多少行,它就多高;结果就是滚动条不起作用;改正的方法很简单:为div指定一个绝对的高度值。上述代码,可将resultsDiv的cssStyle改为(该div其外围的fieldset的高度也是不确定的;所以这里只能指定一个绝对的高度值xxpx,使用%也是不起作用的):
cssStyle="width:100%;overflow-y:auto;overflow-x:hidden;height:200px"




align与valign:
align 是左中右对齐  属性值 left center right
valign 是上中下对齐   属性值top middle bottom


onclick="this.value=''"
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics