有文本节点的CSS选择器吗? [英] Is there a CSS selector for text nodes?

查看:526
本文介绍了有文本节点的CSS选择器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做什么(不是在IE显然)是:

What I would like to do (not in IE obviously) is:

p:not(.list):last-child + :text {
  margin-bottom: 10px;
}

这将给文本节点一个边距。

Which would give a text node a margin. (Is that even possible?) How would I get the text node with CSS?

推荐答案

文本节点不能有边距或任何其他样式,因此您需要应用于样式的任何内容都必须位于元素中。如果你想要你的元素中的一些文本样式不同,将它包装在 span div 例如。

Text nodes cannot have margins or any other style applied to them, so anything you need style applied to must be in an element. If you want some of the text inside of your element to be styled differently, wrap it in a span or div, for example.

这篇关于有文本节点的CSS选择器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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