教程集 www.jiaochengji.com
教程集 >  脚本编程  >  javascript  >  正文 简单的可见即所得的CSS编辑器

简单的可见即所得的CSS编辑器

发布时间:2023-10-15   编辑:jiaochengji.com
教程集为您提供简单的可见即所得的CSS编辑器等资源,欢迎您收藏本站,我们将为您提供最新的简单的可见即所得的CSS编辑器资源

style 也是标签(在非ie内核的浏览器中支持),我们将style设置成 contenteditable的时候,那么那的内容就可以编辑了。仔细的体验下,如果我们将背景修改成红色的。那么只要书写完,立马呈现。哇靠,这很方便我们以后写那种动态的编辑器效果呢,等有时间的话

 代码如下 复制代码
<!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>


想了解更多,可以去这里看看。

本文使用的并非body,而是div,相关代码如下:

 代码如下 复制代码

<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.

您可能感兴趣的文章:

[关闭]
~ ~