Home  >  Article  >  Web Front-end  >  css 给table设置样式

css 给table设置样式

WBOY
WBOYOriginal
2016-06-01 09:53:171152browse

对table设置样式

通过对应table父级样式命名指定对象内table样式

<code class="language-html"> 
 
 
<meta charset="utf-8"> 
<title>指定对象内table设置样式</title> 
<style> 
.manongjc{ width:400px} 
.manongjc table{ background:#CCC; color:#F00} 
.manongjc table td{ background:#FFF} 
</style> 
 
 
<div class="manongjc"> 
<table width="100%" border="0" cellspacing="1" cellpadding="0"> 
<tr> 
<td>内容一</td> 
<td>内容一</td> 
<td>内容一</td> 
</tr> 
<tr> 
<td>内容二</td> 
<td>内容</td> 
<td>内容</td> 
</tr> 
</table> 
</div> 
 
 </code>

复制此代码到这里运行一下

以上通过父级指定table和td进行CSS样式设置。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn