CSS元素内的CSS选择器与内联样式的元素? [英] CSS selector for element within element with inline style?

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

问题描述

有一个CSS选择器来定位具有内联样式的元素吗?所以我可以定位第一跨度,但不是第二与CSS只?

Is there a CSS selector to target elements with inline styles? So can I target the first span but not the 2nd with CSS only?

如果没有,可以使用jQuery吗?

If not, can this be done with jQuery?

http://jsfiddle.net/TYCNE/

<p style="text-align: center;">
    <span>target</span>
</p>

<p>
    <span>not target</span>
</p>
​


推荐答案

p[style="text-align: center;"] {
  color: red;
}

但这很丑陋。

这篇关于CSS元素内的CSS选择器与内联样式的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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