Home > Web Front-end > HTML Tutorial > css parent class inherits subclass_html/css_WEB-ITnose

css parent class inherits subclass_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 12:04:17
Original
1818 people have browsed it

<html><head>	<title>父子关系</title>	<base target="_blank"><style><!--h1{	color:red;					/* 颜色 */	text-decoration:underline;	/* 下划线 */}h1 em{							/* 嵌套选择器 */	color:#004400;				/* 颜色 */	font-size:40px;		text-decoration:none;			/*这个添加上去没有效果;*/}em{ text-decoration:none;}--></style>   </head><body>	<h1>祖国的首都<em>北京</em></h1></body></html>
Copy after login

Beijing inherits the underscore of the parent class

. Now I want to remove the underscore of Beijing. How to do it?
I want to inherit the parent class except Other properties of underscore. Can it be achieved?


Reply to discussion (solution)

Inheritance is actually correct. You are canceling the underline of the child. At this time, the child has no underline. , what you see is actually from the parent, because your em is included in the parent, so it creates an illusion. Half of it does not exist in reality.
To achieve the effect you said, just write it in reverse, cancel the underline in the parent, and set it separately where needed in the child

<style>h1{    color:red;                    /* 颜色 */	-moz-text-decoration-style:solid;	-moz-text-decoration-color:#0F0;	-moz-text-decoration-line:underline;  /* 下划线 */}h1 em{                            /* 嵌套选择器 */    color:#004400;                /* 颜色 */    font-size:40px;	-moz-text-decoration-style:solid;	-moz-text-decoration-color:#00C;	-moz-text-decoration-line:underline;     /*这个添加上去没有效果;*/}</style></head><body>	<h1>祖国的首都<em>北京</em></h1></body>
Copy after login

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