CSS 选择器 : first paragraph's first letter inside a div

标签 css html css-selectors

<div>
 <p>
  Once upon a time..
 </p>
 <p>
  A beautiful princess..
 </p>
</div>

如何选择(在我的 css 中)此 div 中第一段的第一个字母?

谢谢

卢卡

最佳答案

div p:first-of-type:first-letter { font-weight: bold; }

关于CSS 选择器 : first paragraph's first letter inside a div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5721730/

相关文章:

CSS :not([class* ="hidden"]):nth-of-type(4n+1) not working

html - 启用硬件加速时不是绝对的

CSS绝对定位困境

jquery - 居中 div - Bootstrap

javascript - 为什么此脚本仅适用于此列表中的列表项之一?

javascript - 用 DIV 包装 HTML 直到下一个 H3

html - 这种边框如何用CSS实现

java - 关于何时应该将直接缓冲区与 Java NIO 一起用于网络 I/O 的简单规则?

javascript - 如何在表格列的左侧和右侧添加阴影

css - 在这种情况下,为什么 CSS ID 不是最高优先级的 CSS 规则?