Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you style contentEditable in Firefox?

I have the following:

<div contenteditable="true">Item 2</div>

In webkit I can easily style this with css. Firefox is ignoring the css, and making the contenteditable div white and resizable.

How can I modify the css for contentEditable in Firefox. I want the background to be transparent and to disable resizing, and the resizing handle bar.

Thanks

like image 642
AnApprentice Avatar asked Oct 26 '11 18:10

AnApprentice


People also ask

How do I make my page Contenteditable?

Answer: Use the HTML5 contenteditable Attribute You can set the HTML5 contenteditable attribute with the value true (i.e. contentEditable="true" ) to make an element editable in HTML, such as <div> or <p> element.

How do I make a div text editable?

All you have to do is set the contenteditable attribute on nearly any HTML element to make it editable. Here's a simple example which creates a <div> element whose contents the user can edit.

Is Contenteditable safe to use?

Its totally secure. The contenteditable attribute is an enumerated attribute whose keywords are the empty string, true, and false.

How do I make an editable span?

To make a span element editable with JavaScript, we can set the contentEditable property of the span to true . to add a span and a button. to make the span editable when we click on the button. To do this, we select the span and button with querySelector .


1 Answers

You can match the div with this code

div[contenteditable=true] {
   background: rgba(0,0,0,0); /* transparent bg */
   resize:none; /* disable resizing */
}
like image 61
Simone Avatar answered Oct 01 '22 16:10

Simone