CSS 如何禁止标签<a>的继承

html-css014

CSS 如何禁止标签<a>的继承,第1张

吧 A标签的 class 名称设置的一样 然后在css文件中 或者head上的 css代码中设置

实例:

<a href="#" class="a1 a2" >链接文字</a>

<a href="#" class="a1 a2 a3 " >链接文字</a>

<a href="#" class=" a2 " >链接文字</a>

其中 把a1 a2 a3功能分别写出来 这样调用的时候 调用哪个class 就能实现他的功能

一、不能继承的属性

① 盒子模型所有属性:margin、padding、border、width、height。

② 轮廓及背景属性:outline、background。

③ 定位、显示、浮动属性:display、position、top、left、right、bottom、max-*(如max-height等)、overflow、clear、float、content、z-index。

④ 其他:vertical-align、text-decoration、text-shadow、white-space。

注意:内联元素不能继承:text-indent和text-align,但是块级元素可以。

二、元素可继承属性

① 所有元素可继承:visibility、cursor。

② 列表元素可继承:list-style、list-style-type、list-style-position、list-style-image。

③ 字体属性:line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、font-size-adjust。

④ 文本属性:text-transform、direction,除了(text-decoration、text-shadow 内联元素不能继承 ) 块级 可继承。

⑤ 表格布局属性:caption-side、border-collapse、border-spacing、empty-cells、table-layout。

⑥ 其它属性:letter-spacing、word-spacing。

如果还有您知道的,希望可以留言补充。

如果喜欢,不要吝啬你的爱心“❤”哦!

第一点. 现在没有办法,都是从上到下读取的。

第二点.怎么解决呢.

如果同样的名称 是会继承传递的

只有想办法 class 加上id

比如 <div class="top" id="head"></div>

这样区别开来

或者

2.

<a class="top head"></a>

<a class="top body"></a>

<a class="top foot"></a>

这样 只给top共同属性~

然后不一样的属性 标注在 head body 和foot上面 就不会冲突了~