目录
[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

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract


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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version
Useful JavaScript development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment