HTML骨架结构_html/css_WEB-ITnose
目录
[1]文档结构 [2]文档声明 [3]文档头部 [4]文档主体文档结构
一个完整的HTML文档必须包含3个部分:文档声明、文档头部和文档主体。
【最简单的文档结构】
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Document</title></head><body></body></html>
【复杂的文档结构】
<!DOCTYPE html><html><head> <meta charset="utf-8"/> <title>Document</title> <meta name="keywords" content=""/> <meta name="description" content=""/> <meta name="viewport" content="width=device-width"/> <link rel="stylesheet" href="5/style.css"/> <link rel="shortcut icon" href="ico.ico"/></head><body></body></html>
文档声明
告诉浏览器以哪个标准来解析HTML文档
[注意]必须首行、顶格,对大小写不敏感
【HTML版本】
HTML | 1991 |
HTML+ | 1993 |
HTML 2.0 | 1995 |
HTML 3.2 | 1996 |
HTML 4.01 | 1999 |
XHTML 1.0 | 2000 |
HTML5 | 2014 |
【常用声明】
【1】HTML5
<!DOCTYPE html>
【2】在HTML5之前,文档声明一般有三种类型:严格型strict、过渡型transitional、框架frameset
【a】HTML4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
【b】XHTML1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
【c】XHTML1.1 等同于XHTML1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
文档头部
描述了文档的一些基本的属性和信息(可以呈现的是title和icon)
【1】文档标题
【作用】
【a】定义浏览器工具栏中的标题
【b】提供页面被添加到收藏夹时显示的标题
【c】显示在搜索引擎结果中的页面标题
[注意]在所有HTML文档中,
【2】base标签
为页面上所有链接规定默认地址和默认打开方式
<base href="http://baidu.com" target="_blank">
【3】link标签
【a】引入图标
<link rel="shortcut icon" href="ico.ico"/>
【b】引入外部CSS样式表
<link rel="stylesheet" type="text/css" href="mystyle.css" />
【4】style标签和script标签
【a】引入内部CSS样式
<style> body{background-color: red;}</style>
【b】引入javascript
document.onclick = function(){ alert('hello world;')}
【5】meta标签
【a】字符编码,文档的编码一定要与文件本身的编码保持一致,否则会出现乱码,推荐使用UTF-8编码
<meta charset="utf-8"/>
【b】SEO常用到的关键词keywords和描述description
<meta name="description" content="Free Web tutorials on HTML, CSS, JavaScript" /><meta name="keywords" content="HTML, CSS, XML" />
【c】作者、版权
<meta name="author" content="littlematch"><meta name="copyright" content="">
【d】定时跳转(让网页多少秒刷新,或跳转到其他网页)
<meta http-equiv="refresh" content="5"><meta http-equiv="refresh" content="5;url=http://www.baidu.com">
【e】期限(指定网页在缓存中的过期时间)
<meta http-equiv="Expires" Content="0"><meta http-equiv="Expires" Content="Sat Nov 28 2015 21:19:15 GMT+0800">
【f】缓存
<meta http-equiv="Pragma" Content="No-cach">(禁止缓存,访问者无法脱机浏览)
【g】cookie
<meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Sat Nov 28 2015 21:19:15 GMT+0800; path=/">
【h】viewport:视口,移动端常用
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
文档主体
真正可以在页面上看到的内容
【常用标签】
<h1><h2><h3><h4><h5><h6><p><a><img alt="HTML骨架结构_html/css_WEB-ITnose" ><strong><em><br><hr><ul><ol><li><dl><dt><dd><section><header><footer><nav><article><aside><time><table><thead><tbody><caption><tr><th><td><form><input><textarea><button><select><option><label>
[注意]在HTML5标准下,哪些标签可以使用,哪些标签不可以使用,请移步HTML元素和有效的DTD

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.
