Handling a colon in an element ID in a CSS selector(在 CSS 选择器中处理元素 ID 中的冒号)
问题描述
JSF 正在将输入字段的 ID 设置为 search_form:expression.我需要在该元素上指定一些样式,但是该冒号看起来像是浏览器的伪元素的开头,因此它被标记为无效并被忽略.有什么办法可以逃脱冒号之类的吗?
JSF is setting the ID of an input field to search_form:expression. I need to specify some styling on that element, but that colon looks like the beginning of a pseudo-element to the browser so it gets marked invalid and ignored. Is there anyway to escape the colon or something?
input#search_form:expression {
///...
}
推荐答案
反斜杠:
input#search_form:expression { ///...}
- 另请参阅在 CSS 中使用命名空间 (MSDN)
这篇关于在 CSS 选择器中处理元素 ID 中的冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 CSS 选择器中处理元素 ID 中的冒号
基础教程推荐
- fetch 是否支持原生多文件上传? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
