Simple and visible CSS editor

Source: Internet
Author: User

Style is also a label (supported in non-ie kernel browsers). When we set the style to contenteditable, the content can be edited. After careful experience, if we change the background to red. As long as the writing is complete, it will be presented immediately. Wow, it's very convenient for us to write that kind of dynamic editor effect in the future. If you have time

The code is as follows: Copy code
<! Doctype html>
<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>
<Title> </title>
<Style type = "text/css">
Body style {
Display: block;
Background: #333;
Color: white;
Font: 13px/1.8 monaco, mono-space;
Padding: 20px;
White-space: pre;
Margin: 0 auto;
Width: 500px;
Height: 100px;
}
</Style>
</Head>
<Body>
<Style contenteditable> body {background: green ;}</style>
</Body>
</Html>


For more information, visit here.

This document uses a div instead of a body. The code is as follows:

The code is as follows: Copy code

<Style type = "text/css">
. Test_div style {
Display: block;
Background: #333;
Color: white;
Font: 14px/1.8 courier new;
Padding: 20px;
White-space: pre;
Margin: 0 auto;
Width: 250px;
Height: 100px;
}
</Style>

<Div class = "test_div"> <style contenteditable>. test_div {background: green ;}</style> </div>
Have fun.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.