【问题标题】:Can I access an element with inline styling like an input?我可以像输入一样访问具有内联样式的元素吗?
【发布时间】:2015-02-20 04:55:21
【问题描述】:

我知道我可以使用 input[type=text] {} 为输入等元素设置样式,但我可以对具有内联样式的元素执行相同的操作吗?

类似这样的:

<div style="float: right;"></div>

div[style=float:right;] {}

【问题讨论】:

标签: html css css-selectors


【解决方案1】:

你必须这样写

div[style="float:right;"] {
/* propery */
}

【讨论】:

    【解决方案2】:

    您仍然可以使用 CSS 属性选择器;比如sub-string *= selector:

    div[style*="float: right"],
    div[style*="float:right"] { ... }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-13
      • 1970-01-01
      • 2012-12-17
      • 1970-01-01
      • 1970-01-01
      • 2011-04-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多