属性“nowrap"被认为是过时的.建议使用较新的构造.它是什么? [英] Attribute 'nowrap' is considered outdated. A newer construct is recommended. What is it?

查看:36
本文介绍了属性“nowrap"被认为是过时的.建议使用较新的构造.它是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Visual Studio 2010 在 ASPX 页面中编译时遇到错误:

I'm getting an error when compiling this within an ASPX page using Visual Studio 2010:

    <td valign="top" nowrap width="237">

错误信息是

    "Attribute 'nowrap' is considered outdated. A newer construct is recommended."    

错误消息指的是什么结构?它的行为是否与nowrap"完全相同?

What construct is the error message referring to? And does it behave exactly the same as 'nowrap'?

推荐答案

你可以这样使用它,希望你现在不会收到过时的消息.

You can use it like this, I hope you wont get outdated message now.

  <td valign="top" style="white-space:nowrap" width="237">

正如@ThiefMaster 所指出的,建议将 width 和 valign 放在 CSS 中(注意:CSS 称其为 vertical-align).

As pointed by @ThiefMaster it is recommended to put width and valign to CSS (note: CSS calls it vertical-align).

1)

<td style="white-space:nowrap; width:237px; vertical-align:top;">

2)我们可以做一个这样的CSS类,这样更优雅

2) We can make a CSS class like this, it is more elegant way

在风格部分

.td-some-name
{
  white-space:nowrap;
  width:237px;
  vertical-align:top;
}

在 HTML 部分

<td class="td-some-name">

这篇关于属性“nowrap"被认为是过时的.建议使用较新的构造.它是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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