什么能代替HTML5表格中的cellpadding,cellspacing,valign和align? [英] What replaces cellpadding, cellspacing, valign, and align in HTML5 tables?
本文介绍了什么能代替HTML5表格中的cellpadding,cellspacing,valign和align?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Visual Studio 中,我看到了以下警告:
In Visual Studio, I'm seeing these warnings:
- 验证(HTML 5):属性"cellpadding"不是元素"table"的有效属性.
- 验证(HTML 5):属性"cellspacing"不是元素"table"的有效属性.
- 验证(HTML 5):属性'valign'不是元素'td'的有效属性.
- 验证(HTML 5):属性'align'不是元素'td'的有效属性.
- Validation (HTML 5): Attribute 'cellpadding' is not a valid attribute of element 'table'.
- Validation (HTML 5): Attribute 'cellspacing' is not a valid attribute of element 'table'.
- Validation (HTML 5): Attribute 'valign' is not a valid attribute of element 'td'.
- Validation (HTML 5): Attribute 'align' is not a valid attribute of element 'td'.
如果它们在 HTML5 中不是有效属性,那么在CSS中用什么替换它们?
If they are not valid attributes in HTML5, what replaces them in CSS?
推荐答案
/* cellpadding */
th, td { padding: 5px; }
/* cellspacing */
table { border-collapse: separate; border-spacing: 5px; } /* cellspacing="5" */
table { border-collapse: collapse; border-spacing: 0; } /* cellspacing="0" */
/* valign */
th, td { vertical-align: top; }
/* align (center) */
table { margin: 0 auto; }
这篇关于什么能代替HTML5表格中的cellpadding,cellspacing,valign和align?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文