我不想在子标签上影响父母属性? [英] i dont want affect parent property on child tag ?

查看:71
本文介绍了我不想在子标签上影响父母属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<ul>
  <li style="color:red">hi
      <ul>
          <li>1</li>
          <li>2</li>
      </ul>
  </li>
</ul>

推荐答案

您需要为子项应用不同的样式。 CSS中的C代表Cascading,意味着样式的整个意图是它们应该继承或级联。



可以找到几个解决它的建议这里:

http://stackoverflow.com/questions/ 958170 / how-do-i-prevent-css-inheritance [ ^ ]



我还建议将样式移动到CSS而不是使用内联样式。
You need to apply a different style to the children. The "C" in CSS stands for Cascading meaning the whole intent of styles is they are supposed to inherit or cascade down.

Several suggestions for getting around it can be found here:
http://stackoverflow.com/questions/958170/how-do-i-prevent-css-inheritance[^]

I would also suggest moving your styles to CSS instead of using inline styling.


这篇关于我不想在子标签上影响父母属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆