Heim  >  Artikel  >  Web-Frontend  >  请教一个基础问题,CSS的继承_html/css_WEB-ITnose

请教一个基础问题,CSS的继承_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:06:32878Durchsuche

我有一个表格,统一设置了样式 table td {color:red;line-height:30px;}
现在Td里有个Div,我如何设置让它不继承Td的样式?


回复讨论(解决方案)

<html><head>	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script></head><style type="text/css">	 table td {color:red;line-height:30px;}	 table td div{color:green;line-height:10px;} <!--div重新定义一个样式就行了--></style><body>	<table>		<tr>			<td>				<div>dddd</div>				22222			</td>		</tr>	</table></body></html>

重新定义一遍

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