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

css 给table设置样式

WBOY
Release: 2016-06-01 09:53:17
Original
1219 people have browsed it

对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>
Copy after login

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template