设置字体颜色< a>里面的li标签 [英] setting font color of <a> inside a li tag

查看:202
本文介绍了设置字体颜色< a>里面的li标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的标记如下:

<div class="c1">
      <li class="c2"><a href="">blah</a></li>
</div>

我想要文本blah是红色的。

I want the text blah to be red.

c1用于其他地方,因此我希望尽可能多地向下钻取,而不影响其他标记。

c1 is used other places, so I want to drill down as much as possible without affecting other markup.

推荐答案

css文件中的此样式定义:

Use this style definition in your css-file:

div.c1 li.c2 a {
  color: red;
}



PS:拥有< li> code>< ul> -tag不包含< div> 推荐。

PS: Having your <li> tag inside your <div>-tag without an <ul>-tag is not recommended.

这篇关于设置字体颜色&lt; a&gt;里面的li标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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