Home >Web Front-end >HTML Tutorial >I want to ask a basic question, CSS inheritance_html/css_WEB-ITnose

I want to ask a basic question, CSS inheritance_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:06:32942browse

I have a table with unified styles table td {color:red;line-height:30px;}
Now there is a Div in Td. How do I set it so that it does not inherit the style of Td?


Reply to discussion (solution)

<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>

Redefine it

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