有时候在xhtml中,我们会写下像这样的代码:
<table border="1">
,然后在css中再次编写代码table{border:2px solid black}
。我对何时编写哪个代码深感困惑。什么时候使用属性,什么时候使用css。有时它们会让人感到混淆不清。
border
属性:请勿使用此属性,因为它已被弃用:应使用 CSS 样式化<table>
元素。https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/table#attr-border - showdevcellpadding
和cellspacing
:https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/table#Attributes - showdev