Home > Web Front-end > HTML Tutorial > 不用HTML/CSS,JS就够了_html/css_WEB-ITnose

不用HTML/CSS,JS就够了_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 08:48:57
Original
1001 people have browsed it

有人在Github上面建了一个很有意思的项目。你只需要JS就可以创建网页。原理其实很简单,创建一些“html函数”,如: p, div, ul, li 来创建你的网页,而且可以和backbone无缝结合, 下面有个例子:

h1('HTML Creation');p('Tags are functions.')p('Attributes are objects...', {  style:{fontStyle:'italic'}})ul(function(){  li('Nest');  li('with');  li('functions!');});
Copy after login

效果:

HTML Creation

Tags are functions.

Attributes are objects...

  • Nest
  • with
  • functions!

你也用JS来设置些CSS

h1('CSS Creation')css({  '.red':{color:'#e00'},  '.big':{fontSize:'25px'}});div({'class':'red'}, 'This is red');div({c:'big'}, 'This is big');div({c:'big red'}, 'This is both');
Copy after login

效果:

CSS Creation

This is red

This is big

This is both

Github地址: https://github.com/ojjs/oj/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template