加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – HTML属性bgcolor已被弃用:使用什么?

发布时间:2020-12-15 19:25:34 所属栏目:asp.Net 来源:网络整理
导读:VStudio ASP.NET提供以下消息: Attribute 'bgcolor' is considered outdated. A newer construct is recommended. 推荐的结构是什么? bgcolor在 td内元件. 另一个相关的消息是: Attribute 'bordercolor' is not a valid attribute of element 'table'. 有
VStudio ASP.NET提供以下消息:
Attribute 'bgcolor' is considered outdated. A newer construct is recommended.

推荐的结构是什么?

bgcolor在< td>内元件.
另一个相关的消息是:

Attribute 'bordercolor' is not a valid attribute of element 'table'.

有谁知道我可能会找到更新的替代品?

解决方法

W3C HTML 4.0规范中已经废除了 BGColor.

较新的网站和Web应用程序使用CSS(级联样式表)呈现相同的事情,如下所示:

body {
  background-color : #ffffff;
}

对于表,请执行以下操作:

<table>

<tr id="row1">
   <th>Header 1</th>      <td>Cell 1</td>        <td>Cell 2</td>
</tr>
<tr id="row2">
   <th>Header 2</th>      <td>Cell 3</td>        <td>Cell 4</td>
</tr>
<tr id="row3">
   <th>Header 3</th>      <td>Cell 5</td>        <td>Cell 6</td>
</tr>
</table>

在你的CSS中:

th { text-align: center; font-weight: bold; vertical-align: baseline }

td { vertical-align: middle  }

table  { border-collapse: collapse; background-color: #ffffff }
tr#row1 { border-top: 3px solid blue }
tr#row2 { border-top: 1px solid black }
tr#row3 { border-top: 1px solid black }

这样做会使表格具有背景颜色,并与表数据/表格行的其余部分做不同的内容.

简单地说,在您的样式表中,并将其引用到您的网页上,如下所示:

<link rel="stylesheet" href="style.css" TYPE="text/css" media="screen">

你可以把CSS中的任何你喜欢的内容,更多关于CSS here和here的信息.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读