Heim  >  Artikel  >  Web-Frontend  >  css 给table设置样式

css 给table设置样式

WBOY
WBOYOriginal
2016-06-01 09:53:171153Durchsuche

对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样式设置。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn