Home >Web Front-end >HTML Tutorial >I want to ask a basic question, CSS inheritance_html/css_WEB-ITnose
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?
<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