css selector for html5 tag “Contenteditable” [duplicate]

a 夏天 提交于 2021-02-19 07:55:09

问题


How can I use css selector for contenteditable="true"

<div id="1" name="1" contentEditable="true"></div>

回答1:


Use a CSS attribute selector:

div[contenteditable="true"] {
    background: red;
}

In English, this means: "Find all divs which have an attribute of contenteditable with its value set to true." In the above example, we find all div elements that are contenteditables and give them a red background.




回答2:


Specify html selector, then in square brackets desired attribute and its value

div[contentEditable="true"]



回答3:


You can select any type of attribute with the css selector for attributes, just use [atttributeName].



来源:https://stackoverflow.com/questions/45128310/css-selector-for-html5-tag-contenteditable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!