


Generally speaking, when people write documents including HTML, they are accustomed to follow a hierarchical structure similar to "Chapter - Section - Subsection".
Description method in HTML4:
<html> <head> </head> <body> <h1 id="第一章-nbsp-小强的HTML-移动开发之路">第一章 小强的HTML5移动开发之路</h1> <h2 id="nbsp-HTML-概述">1.1 HTML5概述</h2> <h3 id="nbsp-HTML-是什么">1.1.1 HTML5是什么?</h3> <h3 id="nbsp-HTML-和HTML-的区别">1.1.2 HTML5和HTML4的区别</h3> <h2 id="nbsp-HTML-快速入门">1.2 HTML5快速入门</h2> <h3 id="nbsp-HTML与XHTML">1.2.1 HTML与XHTML</h3> </body> </html>
The above code can barely see the main structure of the document. However, in more complex pages, this structure is difficult to see, so the following writing method appears:
<html> <head> </head> <body> <p> <h1 id="第一章-nbsp-小强的HTML-移动开发之路">第一章 小强的HTML5移动开发之路</h1> <p> <h2 id="nbsp-HTML-概述">1.1 HTML5概述</h2> <p> <h3 id="nbsp-HTML-是什么">1.1.1 HTML5是什么?</h3> </p> <p> <h3 id="nbsp-HTML-和HTML-的区别">1.1.2 HTML5和HTML4的区别</h3> </p> </p> <p> <h2 id="nbsp-HTML-快速入门">1.2 HTML5快速入门</h2> <p> <h3 id="nbsp-HTML与XHTML">1.2.1 HTML与XHTML</h3> </p> </p> <p> </body> </html>
in HTML5 , in order to make the document structure clearer and easier to understand, many semantic elements specially used to divide the document structure have been added.
section element: The section element is the most basic and main structural element that divides the page document structure. It is mainly used to organize websites or applications. The content on the program pages is divided hierarchically. A section element usually consists of content and its title.
<html> <head> </head> <body> <section> <h1 id="第一章-nbsp-小强的HTML-移动开发之路">第一章 小强的HTML5移动开发之路</h1> <section> <h2 id="nbsp-HTML-概述">1.1 HTML5概述</h2> <section> <h3 id="nbsp-HTML-是什么">1.1.1 HTML5是什么?</h3> </section> <section> <h3 id="nbsp-HTML-和HTML-的区别">1.1.2 HTML5和HTML4的区别</h3> </section> </section> <section> <h2 id="nbsp-HTML-快速入门">1.2 HTML5快速入门</h2> <section> <h3 id="nbsp-HTML与XHTML">1.2.1 HTML与XHTML</h3> </section> </section> <section> </body> </html>
When using the section element, please note:
1. Do not confuse the section element with the p element. . When a container needs to define styles directly or define behavior through scripts, it is recommended to use p.
2. It is generally not recommended to use section for content without titles. You can use the HTML5 outline detection tool to detect it (http:/ /www.php.cn/)
article element: The article element represents all "text" parts in a document, page or application, and the content it describes should be independent and complete It can be cited externally by itself, which can be a blog, a newspaper article, a forum post, a user review, an independent plug-in, or any other content that is independent of other parts of the context.
In a section element or article element, there should be only one title. If there are two titles, the second title will be implicitly placed into a new section element, as shown in the following code Indicates that the content after the h2 element will be implicitly placed into a new section element.
<article> <h1 id="标题">标题</h1> <!--隐式创建出一个新的section元素--> <h2 id="副标题">副标题</h2> </article>
nav element: The nav element is a group of links that can be used as page navigation. A page can have multiple nav elements, which serve as navigation for the entire page or different parts of the page. In the nav element, the shuffling link element is generally placed in the form of a ul list.
aside element: The aside element is used to represent the subsidiary information part of the current page or article. It can contain references related to the current page or main content. , sidebars, ads, navigation bars, and other parts that are different from the main content.
Let’s implement an example of a blog homepage:
The interface layout is as follows:
##
<!DOCTYPE html> <meta charset="UTF-8"> <title>阳光小强的博客</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="" name="keywords"> <meta content="" name="description"> <link href="main.css" type="text/css" rel="stylesheet"/> <p id="blog"> <header id="bloghead"> <p id="blogTitle"> <h1 id="阳光小强的博客">阳光小强的博客</h1> <p id="bloglink"> http://www.php.cn/ </p> </p> <nav id="blognav"> <ul id="blognavInfo"> <li> <a href="http://blog.csdn.net/dawanganban" id="on">主页</a> </li> <li> <a href="#">博文目录</a> </li> </ul> </nav> </header> <p id="blogbody"> <p id="column_1"> <aside> <section> <header> <h1 id="个人资料">个人资料</h1> </header> <p id="connBody1"> <p> <figure> <img src="/static/imghwm/default1.png" data-src="image\head.jpg" class="lazy" alt="Xiaoqiang's HTML5 mobile development road (42) - Comparison of HTML4 and HTML5 document structures" > <figcaption>阳光小强的博客</figcaption> </figure> </p> <p id="pSpecial"> <p>本人目前从事移动互联网开发,希望结识更多朋友</p> <p>推荐专栏:</p> <p> <a target="_blank" href="http://blog.csdn.net/column/details/dawanganban-html5.html"> 小强的HTML5移动开发之路 </a> </p> <p>联系方式:739299362</p> </p> </p> <p id="connFoot1"></p> </section> <section id="conn2"> <header id="connHead2"> <h1 id="分类">分类</h1> <span id="edit1"> <a href="javascript:;" onclick="window.CateDialog.show();return false;"> [<cite>管理</cite>] </a> </span> </header> <p id="connBody2"> <nav id="classList"> <ul> <li id="dot1"> <a target="_blank" href="#">全部博文</a> <em>(62)</em> </li> <li id="dot2"> <a href="#" target="_blank">HTML5</a> <em>(40)</em> </li> <li id="dot3"> <a href="#" target="_blank">HTML5</a> <em>(40)</em> </li> <li id="dot4"> <a href="#" target="_blank">HTML5</a> <em>(40)</em> </li> <li id="dot5"> <a href="#" target="_blank">HTML5</a> <em>(40)</em> </li> </ul> </nav> </p> <p id="connFoot2"></p> </section> <section id="conn3"> <header id="connHead3"> <h1 id="评论">评论</h1> </header> <p id="connBody3"> <nav id="zComments"> <ul id="zCommentsUl"> <li id="commentsCell_linedot1"> <p id="commentsH1"> <span id="commentsName_txtc_dot1"> <a href="#" target="_blank" title="随风"> 随风 </a> </span> <time datetime="2014-03-31T16:59">03-31 16:59</time> </p> <p id="commentsContants1"> <p id="commentsContantsTxt1"> <a href="#" target="_blank"> 博主,您好。为什么我在url中输... </a> </p> </p> </li> <li id="commentsCell_linedot2"> <p id="commentsH1"> <span id="commentsName_txtc_dot1"> <a href="#" target="_blank" title="随风"> 随风 </a> </span> <time datetime="2014-03-31T16:59">03-31 16:59</time> </p> <p id="commentsContants1"> <p id="commentsContantsTxt1"> <a href="#" target="_blank"> 博主,您好。为什么我在url中输... </a> </p> </p> </li> <li id="commentsCell_linedot3"> <p id="commentsH1"> <span id="commentsName_txtc_dot1"> <a href="#" target="_blank" title="随风"> 随风 </a> </span> <time datetime="2014-03-31T16:59">03-31 16:59</time> </p> <p id="commentsContants1"> <p id="commentsContantsTxt1"> <a href="#" target="_blank"> 博主,您好。为什么我在url中输... </a> </p> </p> </li> <li id="commentsCell_linedot4"> <p id="commentsH1"> <span id="commentsName_txtc_dot1"> <a href="#" target="_blank" title="随风"> 随风 </a> </span> <time datetime="2014-03-31T16:59">03-31 16:59</time> </p> <p id="commentsContants1"> <p id="commentsContantsTxt1"> <a href="#" target="_blank"> 博主,您好。为什么我在url中输... </a> </p> </p> </li> </ul> </nav> </p> <p id="connFoot3"></p> </section> </aside> </p> <p id="column_2"> <section id="conn4"> <header id="connHead4"> <h1 id="分类">分类</h1> <span id="edit2"> <a href="javascript:;" onclick="window.CateDialog.show();return false;"> [<cite>管理</cite>] </a> </span> </header> <p id="connBody4"> <p id="bloglist"> <section> <header> <p id="blog_title_h1"> <h1 id="blog_title1"> <a href="#" target="_blank"> HTML5中新增number元素的ValueAsNumber属性 </a> </h1> <img src="/static/imghwm/default1.png" data-src="image/head.jpg" class="lazy" title="此博文包含图片" id="icon1" alt="Xiaoqiang's HTML5 mobile development road (42) - Comparison of HTML4 and HTML5 document structures" > <time datetime="2014-03-31T18:30" pubdate>(2014-03-31 18:30)</time> </p> <p id="articleTag1"> <span id="txtb1">分类:</span> <a target="_blank" href="#">HTML5</a> </p> </header> <p id="content1"> <p> 在使用JavaScript脚本对HTML5中number元素进行操作的时候,可以使用valueAsNumber属性很轻松地设置和读取元素中的数值。</p> <p> 在使用JavaScript脚本对HTML5中number元素进行操作的时候,可以使用valueAsNumber属性很轻松地设置和读取元素中的数值。</p> <p> 在使用JavaScript脚本对HTML5中number元素进行操作的时候,可以使用valueAsNumber属性很轻松地设置和读取元素中的数值。</p> <p> 在使用JavaScript脚本对HTML5中number元素进行操作的时候,可以使用valueAsNumber属性很轻松地设置和读取元素中的数值。</p> <p> 在使用JavaScript脚本对HTML5中number元素进行操作的时候,可以使用valueAsNumber属性很轻松地设置和读取元素中的数值。</p> </p> <footer id="tagMore1"> <p id="tag_txtc1"> <a href="#" target="_blank">阅读</a> | <a target="_blank" href="#">评论</a> 还没有被转载| <a href="javascript:;" onclick="return false;">收藏</a> </p> <p id="more1"> <span id="smore1"> <a href="#" target="_blank">查看全文</a>>> </span> </p> </footer> </section> </p> </p> </section> </p>Style file main.css
p#blog{ background-position:50% 0%; background-image:url(image/blogb.png); width:100%; /*background-repeat:no-repeat;*/ } ul{ list-style:none; } p#blogbody{ margin:0px; } [id^=column_]{ display:inline; float:left; overflow:hidden; } p#column_1{ margin-left:20px; width:210px; }The above is Xiaoqiang’s HTML5 mobile development road (42) - Comparison of HTML4 and HTML5 document structures. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

html5的div元素默认一行不可以放两个。div是一个块级元素,一个元素会独占一行,两个div默认无法在同一行显示;但可以通过给div元素添加“display:inline;”样式,将其转为行内元素,就可以实现多个div在同一行显示了。

html5中列表和表格的区别:1、表格主要是用于显示数据的,而列表主要是用于给数据进行布局;2、表格是使用table标签配合tr、td、th等标签进行定义的,列表是利用li标签配合ol、ul等标签进行定义的。

固定方法:1、使用header标签定义文档头部内容,并添加“position:fixed;top:0;”样式让其固定不动;2、使用footer标签定义尾部内容,并添加“position: fixed;bottom: 0;”样式让其固定不动。

html5中不支持的标签有:1、acronym,用于定义首字母缩写,可用abbr替代;2、basefont,可利用css样式替代;3、applet,可用object替代;4、dir,定义目录列表,可用ul替代;5、big,定义大号文本等等。

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。

因为html5不基于SGML(标准通用置标语言),不需要对DTD进行引用,但是需要doctype来规范浏览器的行为,也即按照正常的方式来运行,因此html5只需要写doctype即可。“!DOCTYPE”是一种标准通用标记语言的文档类型声明,用于告诉浏览器编写页面所用的标记的版本。


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

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
