Beispiel:HTML-Universalattribute-contenteditable-1.html
<!DOCTYPE HTML> <html lang="de"> <head>
<meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" > <title>Contenteditable - 2</title> <style>
[contenteditable] { padding: 1em; outline: medium dashed #CCC; } [contenteditable]:hover { outline: medium dashed #c82f04; }
p {
color: grey; font-style: italics;
}
</style> </head>
<body>
Contenteditable - Style zeigen
Ein normaler Textabsatz in roter Schrift, festgelegt durch die Regeln des dokumentweiten style-Elements.
Dieser Absatz hat eine eindeutige id und enthält ein style-Element. Dieses legt eine blaue Schriftfarbe fest. <style contenteditable> p#spielwiese { background: #e6f2f7; color: blue; } style { display: block; color: RebeccaPurple; font-family: monospace; margin: 1em; white-space: pre; } </style> Außerdem wird der Inhalt des style-Elements angezeigt. Diesen kannst du durch das contenteditable-Attribut beliebig ändern.
</body> </html>