说明:本文引用的部分配图来源于 Jon Duckett 所著的《HTML and CSS: Design and Build Websites》,这是一本极具价值的前端入门教程,感兴趣的读者可前往亚马逊等电商平台购买该书。
HTML 是用于定义网页结构的标记语言,其英文全称为 Hyper-Text Markup Language(超文本标记语言)。我们在浏览器中看到的文字内容、交互按钮、图片素材、视频资源等各类页面元素,均是通过 HTML 编写后由浏览器解析渲染呈现的。



<!doctype html><!DOCTYPE HTMLPUBLIC"-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"><!DOCTYPE HTMLPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><!-- 这是一段注释,注释不能够嵌套 -->








&&、||、!if...else...switch...cas...default...for循环while循环do...while循环this关键字delete关键字Number / String / Boolean / Symbol / Array / FunctionDate / Error / Math / RegExp / Object / Map / SetJSON / Promise / Generator / Reflect / Proxywindow对象的属性和方法history对象forward() / back() / go()location对象navigator对象screen对象getElementById() / querySelector()getElementsByClassName() / getElementsByTagName() / querySelectorAll()parentNode / previousSibling / nextSibling / children / firstChild / lastChildnodeValueinnerHTML / textContent / createElement() / createTextNode() / appendChild() / insertBefore() / removeChild()className / id / hasAttribute() / getAttribute() / setAttribute() / removeAttribute()load / unload / error / resize / scrollkeydown / keyup / keypressclick / dbclick / mousedown / mouseup / mousemove / mouseover / mouseoutfocus / blurinput / change / submit / reset / cut / copy / paste / selecttarget(有些浏览器使用srcElement)typecancelablepreventDefault()stopPropagation()(低版本IE中的cancelBubble)screenX和screenYpageX和pageYclientX和clientYkeyCode属性(有些浏览器使用which)String.fromCharCode(event.keyCode)DOMContentLoadedhashchangebeforeunloadlocalStorage和sessionStoragelocalStorage.colorSetting = '#a4509b';localStorage['colorSetting'] = '#a4509b';localStorage.setItem('colorSetting', '#a4509b');geolocationnavigator.geolocation.getCurrentPosition(function(pos) { console.log(pos.coords.latitude)console.log(pos.coords.longitude)})<canvas>的API<audio>和<video>的API前后端分离开发(前端渲染)必选框架。
<scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><divid="app"><h1>{{ product }}库存信息</h1></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {product: 'iPhone X' } });</script><divid="app"><h1>库存信息</h1><hr><ul><liv-for="product in products"> {{ product.name }} - {{ product.quantity }}<spanv-if="product.quantity === 0"> 已经售罄</span></li></ul></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {products: [ {"id": 1, "name": "iPhone X", "quantity": 20}, {"id": 2, "name": "华为 Mate20", "quantity": 0}, {"id": 3, "name": "小米 Mix3", "quantity": 50} ] } });</script><divid="app"><h1>库存信息</h1><hr><ul><liv-for="product in products"> {{ product.name }} - {{ product.quantity }}<spanv-if="product.quantity === 0"> 已经售罄</span></li></ul><h2>库存总量:{{ totalQuantity }}台</h2></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {products: [ {"id": 1, "name": "iPhone X", "quantity": 20}, {"id": 2, "name": "华为 Mate20", "quantity": 0}, {"id": 3, "name": "小米 Mix3", "quantity": 50} ] },computed: {totalQuantity() {returnthis.products.reduce((sum, product) => {return sum + product.quantity }, 0); } } });</script><divid="app"><h1>库存信息</h1><hr><ul><liv-for="product in products"> {{ product.name }} - {{ product.quantity }}<spanv-if="product.quantity === 0"> 已经售罄</span><button @click="product.quantity += 1"> 增加库存</button></li></ul><h2>库存总量:{{ totalQuantity }}台</h2></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {products: [ {"id": 1, "name": "iPhone X", "quantity": 20}, {"id": 2, "name": "华为 Mate20", "quantity": 0}, {"id": 3, "name": "小米 Mix3", "quantity": 50} ] },computed: {totalQuantity() {returnthis.products.reduce((sum, product) => {return sum + product.quantity }, 0); } } });</script><divid="app"><h1>库存信息</h1><hr><ul><liv-for="product in products"> {{ product.name }} - <inputtype="number"v-model.number="product.quantity"min="0"><spanv-if="product.quantity === 0"> 已经售罄</span><button @click="product.quantity += 1"> 增加库存</button></li></ul><h2>库存总量:{{ totalQuantity }}台</h2></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {products: [ {"id": 1, "name": "iPhone X", "quantity": 20}, {"id": 2, "name": "华为 Mate20", "quantity": 0}, {"id": 3, "name": "小米 Mix3", "quantity": 50} ] },computed: {totalQuantity() {returnthis.products.reduce((sum, product) => {return sum + product.quantity }, 0); } } });</script><divid="app"><h2>库存信息</h2><ul><liv-for="product in products"> {{ product.name }} - {{ product.quantity }}<spanv-if="product.quantity === 0"> 已经售罄</span></li></ul></div><scriptsrc="https://cdn.jsdelivr.net/npm/vue"></script><script>const app = newVue({el: '#app',data: {products: [] },created() {fetch('https://jackfrued.top/api/products') .then(response => response.json()) .then(json => {this.products = json }); } });</script>Vue为商业项目开发提供了非常便捷的脚手架工具vue-cli,通过工具可以省去手工配置开发环境、测试环境和运行环境的步骤,让开发者只需要关注要解决的问题。
基于Vue 2.0的桌面端组件库,用于构造用户界面,支持响应式布局。
<!-- 引入样式 --><linkrel="stylesheet"href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"><!-- 引入组件库 --><scriptsrc="https://unpkg.com/element-ui/lib/index.js"></script><!DOCTYPE html><html><head><metacharset="UTF-8"><linkrel="stylesheet"href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"></head><body><divid="app"><el-button @click="visible = true">点我</el-button><el-dialog:visible.sync="visible"title="Hello world"><p>开始使用Element吧</p></el-dialog></div></body><scriptsrc="https://unpkg.com/vue/dist/vue.js"></script><scriptsrc="https://unpkg.com/element-ui/lib/index.js"></script><script>newVue({el: '#app',data: {visible: false, } })</script></html><!DOCTYPE html><html><head><metacharset="UTF-8"><linkrel="stylesheet"href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"></head><body><divid="app"><el-table:data="tableData"stripestyle="width: 100%"><el-table-columnprop="date"label="日期"width="180"></el-table-column><el-table-columnprop="name"label="姓名"width="180"></el-table-column><el-table-columnprop="address"label="地址"></el-table-column></el-table></div></body><scriptsrc="https://unpkg.com/vue/dist/vue.js"></script><scriptsrc="https://unpkg.com/element-ui/lib/index.js"></script><script>newVue({el: '#app',data: {tableData: [ {date: '2016-05-02',name: '王一霸',address: '上海市普陀区金沙江路 1518 弄' }, {date: '2016-05-04',name: '刘二狗',address: '上海市普陀区金沙江路 1517 弄' }, {date: '2016-05-01',name: '杨三萌',address: '上海市普陀区金沙江路 1519 弄' }, {date: '2016-05-03',name: '陈四吹',address: '上海市普陀区金沙江路 1516 弄' } ] } })</script></html>百度出品的开源可视化库,常用于生成各种类型的报表。

Bulma是一个基于Flexbox的现代化的CSS框架,其初衷就是移动优先(Mobile First),模块化设计,可以轻松用来实现各种简单或者复杂的内容布局,即使不懂CSS的开发者也能够使用它定制出漂亮的页面。
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>Bulma</title><linkhref="https://cdn.bootcss.com/bulma/0.7.4/css/bulma.min.css"rel="stylesheet"><styletype="text/css">div { margin-top: 10px; }.column { color: #fff; background-color: #063; margin: 10px10px; text-align: center; }</style></head><body><divclass="columns"><divclass="column">1</div><divclass="column">2</div><divclass="column">3</div><divclass="column">4</div></div><div><aclass="button is-primary">Primary</a><aclass="button is-link">Link</a><aclass="button is-info">Info</a><aclass="button is-success">Success</a><aclass="button is-warning">Warning</a><aclass="button is-danger">Danger</a></div><div><progressclass="progress is-danger is-medium"max="100">60%</progress></div><div><tableclass="table is-hoverable"><tr><th>One</th><th>Two</th></tr><tr><td>Three</td><td>Four</td></tr><tr><td>Five</td><td>Six</td></tr><tr><td>Seven</td><td>Eight</td></tr><tr><td>Nine</td><td>Ten</td></tr><tr><td>Eleven</td><td>Twelve</td></tr></table></div></body></html>用于快速开发Web应用程序的前端框架,支持响应式布局。

国内直接使用顶级AI工具
谷歌浏览器访问:https://www.nezhasoft.cloud/r/vMPJZr
