html - 在 CSS 中,如何获取 2nd degree parent 的颜色?

标签 html twitter-bootstrap css

我有这个 html 代码:

some text, blablabla
<ul>
  <li>hello</li>
  <li>hola</li>
</ul

我需要将列表中的点涂成更大的蓝色,但我还需要列表的文本保持原样(与“一些文本,blablabla”相同的字体、颜色和大小)。

所以我尝试使用这样的 span 标签,

some text, blablabla
<ul>
<li style="color: #00B0F0;font-size: 200%;"><span style="font-size: 100%;color:default;">hello</span></li>
<li style="color: #00B0F0;font-size: 200%;"><span style="font-size: 100%;color:default;">hola</span></li>
</ul>

但是,它不起作用,即列表中的文本与点(蓝色)的颜色相同。

所以,我必须想办法将列表前文本的颜色应用到列表的文本上(知道我不知道我要应用的文本属性,我只是应用特定的字体). 有什么想法吗?

谢谢

enter image description here

最佳答案

您可以只使用 css content 并根据您的要求显示元素符号列表。像这样:

ul {
  list-style: none;
}

ul li:before {
  content: "•";
  font-size: 30px;
  color: blue;
  padding-right: 5px;
}
<ul>
  <li>item 1</li>
  <li>item 2</li>
</ul>

关于html - 在 CSS 中,如何获取 2nd degree parent 的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44197426/

相关文章:

php - Bootstrap 面板填充可用宽度

jquery - 在 Bootstrap 弹出窗口中渲染 React 组件

javascript - Facebook、Instagram 和 Twitter 浏览器未返回正确的视口(viewport)高度

html - 如果在输入 [类型 ='number'] 中插入字母表,如何停止光标移动?

javascript - Bootstrap 按钮悬停问题

css - Rails 和 Compass - 为每个 View / Controller 创建不同 CSS 的正确方法是什么?

html - 在斜杠 (/) 上打断 HTML 文本的最佳方法是什么?

html - python从html文件中提取电子邮件地址到另一个文件中

javascript - 过渡组动画在添加第三个元素时改变行为

css - 如何将 CSS url 设置为绝对位置?