HTML网页代码实时效果预览器

🌌 365体育官网下载 ⏳ 2025-07-23 12:34:37 👤 admin 👁️ 6103 💖 883
HTML网页代码实时效果预览器

HTML网页代码实时效果预览器

可以用于学习和实验HTML和CSS,实时效果预览,比较便捷。源码参考自网络。

功能

实时预览:当你在左侧的“代码编辑器”中输入代码时,右侧的“预览窗口”会实时显示你的网页效果(注意,不能体现嵌入的JavaScript运行效果)。

清空代码:如果你想要重新开始,只需点击页脚的“清空代码”按钮。

屏显切换:想要更大的编辑空间?点击“屏显切换”,如果你想要退出全屏模式,只需再次点击“屏显切换”或者使用浏览器的全屏退出功能。

下面给出一段输入测试代码(你当然可以输入其它网页代码试试):

测试

测试

  • 项目1
  • 项目2

内容

运行效果

这个HTML网页代码预览器,由两个文件组成(请将两个文件在同一个文件夹中):

(1)html文件源码如下:

HTML网页代码预览器

HTML网页代码预览器

设计:

(2) normalize.css文件

上面的html文件用到的normalize.css文件,内容如下:

/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */

html {

line-height: 1.15;

-webkit-text-size-adjust: 100%

}

body {

margin: 0

}

main {

display: block

}

h1 {

font-size: 2em;

margin: .67em 0

}

hr {

box-sizing: content-box;

height: 0;

overflow: visible

}

pre {

font-family: monospace,monospace;

font-size: 1em

}

a {

background-color: transparent

}

abbr[title] {

border-bottom: none;

text-decoration: underline;

text-decoration: underline dotted

}

b,strong {

font-weight: bolder

}

code,kbd,samp {

font-family: monospace,monospace;

font-size: 1em

}

small {

font-size: 80%

}

sub,sup {

font-size: 75%;

line-height: 0;

position: relative;

vertical-align: baseline

}

sub {

bottom: -.25em

}

sup {

top: -.5em

}

img {

border-style: none

}

button,input,optgroup,select,textarea {

font-family: inherit;

font-size: 100%;

line-height: 1.15;

margin: 0

}

button,input {

overflow: visible

}

button,select {

text-transform: none

}[type=button],[type=reset],[type=submit],button {

-webkit-appearance: button

}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner {

border-style: none;

padding: 0

}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring {

outline: 1px dotted ButtonText

}

fieldset {

padding: .35em .75em .625em

}

legend {

box-sizing: border-box;

color: inherit;

display: table;

max-width: 100%;

padding: 0;

white-space: normal

}

progress {

vertical-align: baseline

}

textarea {

overflow: auto

}[type=checkbox],[type=radio] {

box-sizing: border-box;

padding: 0

}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button {

height: auto

}[type=search] {

-webkit-appearance: textfield;

outline-offset: -2px

}[type=search]::-webkit-search-decoration {

-webkit-appearance: none

}

::-webkit-file-upload-button {

-webkit-appearance: button;

font: inherit

}

details {

display: block

}

summary {

display: list-item

}[hidden],template {

display: none

}

请按前面所说将两个文件在同一个文件夹中。现在,你可以用浏览器打开html文件,输入测试代码试试了。

相关文章