问题
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