本文解释了nowrap是什么意思,以及在td中nowrap的使用,并提供了一个详细的完整代码来具体演示教学。
nowrap是什么意思?
HTML中td元素的nowrap属性表示禁止单元格中的文字自动换行。
但使用时要注意的是,td元素noWrap属性的行为与td元素的width属性有关。td元素中nowrap属性的行为与td元素的width属性有关。如果未设置td宽度,则nowrap属性起作用的,如果设置了td宽度,则nowrap属性不起作用。
nowrap详细解说
nowrap表示是否允许表格中的文本换行
nowrap=true的时候不能换行
nowrap=false可以换行
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> </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> </td>
</tr>
</table>
</body>
</html>
分享到:
相关推荐
HTML中td元素的nowrap属性表示禁止单元格中的文字自动换行
td nowrap css nowrap使用说明于注意事项
但使用时要注意的是,td元素中nowrap属性的行为与td元素的width属性有关。如果未设置td宽度,则nowrap属性起作用的,如果设置了td宽度,则nowrap属性不起作用。 通过CSS让TD自动换行 项目中 ajax 应用需要动态创建...
慢日志发送邮件脚本 filedir="/data/mysql/tmp/sqlcount.xls" tmpfile="/tmp/sqlcount.xls" ...echo '<tr> <td>ip地址</td> <td>所属业务</td> <td>库名</td> <td>执行时间</td> <td>sql</td></tr>' >> ${tmpfile}
<td nowrap="nowrap" width="160" align=left><img src="img/phone.jpg" width="25" height="20" border="0" align="absmiddle" /><%= rs("m_phone") %></td> </tbody></table> ():Wend end if %> <div>...
最近的做的一个小项目...首先设置表格的样式table-layout:fixed再设置表格的宽度(这步必须) 最后再设置td样式的三个必要属性 复制代码代码如下: text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
所谓省略就是把多余的字以“…”显示出来,而显示则是当鼠标移动到td上时,把省略的字重新显示出来。对于一个table,兼容IE与FF、Chrome的省略方式CSS写法: 复制代码代码如下: table{ width:200px; table-layout: ...
<td width="213" align="right" nowrap="nowrap">版块名称</td> <td width="719"><input type="text" name="boardname" value="" size="32" /> </td> <td nowrap="nowrap" align="right">版主</td> <td>...
</td> <td width="580" colspan="3" nowrap bgcolor="#FFFFFF">("a_classid","p_class",0)%></td> </tr><br> <tr><br> <td nowrap bgcolor="#FFFFFF">字段类型:</td> <td colspan="3" nowrap bgcolor=...
css +=" white-space: nowrap"; css +="}"; css +="th{"; css +=" border: 1px solid #ddd;"; css +=" text-align: left;"; css +="}"; css +="</style>"; String html = "<html><head>"+css...
} td {white-space:nowrap;overflow:hidden;word-break:keep-all;text-overflow:ellipsis} </style> <table border=1> <tr> <td width=”30%”>dd</td> <td>...
代码如下: <!DOCTYPE html PUBLIC “-/... <body> <style type=”text/css”> table {width:200px;table-layout:fixed;} td {white-space:nowrap;overflow:hidden;word-break:keep-all;} </style>
不记得是什么时候,有人在用table模拟DataGrid的时候说,为什么td超出设置为固定宽度的文字不能隐藏,而是会直接换行呢? 是的,事实确实如此,如: <style type=”text/css”> table {width:500px;...
CSS实现超长字段用省略号代替 td的属性中注意nowrap有效不能设置width,但是可以设置table的width
...td noWrap> <table><br> <tr><br> <td noWrap><asp:label id="Sum" CssClass="Label1" runat="server"></asp...label>|<asp:label id="Count" CssClass="Label1" runat="server"></asp:label>|...
<td align="left" valign="middle" nowrap><font color="#FFFFFF"><B>欢迎光临</B></font></td> </td> <td width="3" background="image/link.GIF"></td> <td> <td> <td> ...
white-space:nowrap; text-overflow:ellipsis; text-overflow: ellipsis;/* IE/Safari */ -ms-text-overflow: ellipsis; -o-text-overflow: ellipsis;/* Opera */ -moz-binding: url("ellipsis.xml#ellipsis");/*...
.testMethodStatusFAIL td, .testMethodStatusPASS td, .testMethodStatusSKIP td { padding: 3px; } .testMethodDetails, .testMethodDetailsVisible { padding: 5px; background-color: #f5f5f5; margin: 1...