📜  css 选择 div 内的文本 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:48:01.107000             🧑  作者: Mango

代码示例1
CSS doesn't work this way. As biziclop says in the comments, text nodes can't be selected with CSS. You'll either have to wrap your text in a  and use

.test span {
    cursor: pointer;
}
With

Text
Or set .test to display: inline, but that won't let you give it a width, which is not the behaviour you want. s are fine, in this case.