好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

css父类继承子类_html/css_WEB-ITnose

  	 父子关系 	         	

祖国的首都 北京


北京 继承了父类

的下划线,我现在想去掉北京的下划线 ,要怎么做
我想要 继承父类 除了下划线的其他属性。能实现吗?


回复讨论(解决方案)

继承的话其实是正确的,你在取消的子级的下划线,此时,子级没有下划线,你看到的其实是父级的,因为你的em包含在父级里,所以造成了错觉,一半在实际中这样的写法是不存在的。
要实现你说的效果的话就是反过来写,父级取消下划线,在子级需要的地方单独的去设置

 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;     /*这个添加上去没有效果;*/}   	

祖国的首都 北京

查看更多关于css父类继承子类_html/css_WEB-ITnose的详细内容...

  阅读:32次