search
HomeWeb Front-endHTML Tutorial[Html Css] css naming convention, html tag semantics_html/css_WEB-ITnose

<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>css命名规范、html标签语义化</title>    <style>        dl,li { font: 12px/24px 'simsun';}        dl dt { font-weight: bold; }    </style></head><body><div class="link">    <a href="http://www.html5jscss.com/html5-semantics-section-30.html">本文参考文章1</a>    <a href="http://www.html5jscss.com/html5-semantics-rich-60.html">本文参考文章2</a></div><section>    <h1 id="命名规范">命名规范</h1>    <article>        <ol>            <li>命名只能是[a-zA-Z0-9]、连字符(-)、下划线(_)</li>            <li>命名必须以字母开头命名、单词间用下换线(main_left)连接或驼峰命名(mainLeft、MainLeft)</li>            <li>语义化命名{侧边栏:sidebar,主要内容:main}</li>        </ol>    </article></section><section>    <h1 id="html标签语义化">html标签语义化</h1>    <article>        <dl>            <dt>header元素</dt>            <dd>描述:“网页”或“section”的页头,一般包括h1-h6、hgroup、nav、logo相关等。</dd>            <dd>注意:没有个数限制,如果hgroup或h1-h6自己就能工作的很好,那就不要用header。</dd>            <dd>示例:header>hgroup>h1+h2</dd>        </dl>        <dl>            <dt>footer元素</dt>            <dd>描述:“网页”或“section”的页脚,一般包括版权等。</dd>            <dd>注意:没有个数限制。</dd>            <dd>示例:footer{copyright&copy;2013}</dd>        </dl>        <dl>            <dt>hgroup元素</dt>            <dd>描述:“网页”或“section”的标题,或组合h1-h6。</dd>            <dd>注意:连续多个h1-h6标签需要用hgroup,只有一个h1-h6不需要hgroup,</dd>            <dd>示例:hgroup>h1+h2</dd>        </dl>        <dl>            <dt>nav元素</dt>            <dd>描述:定义主导航。</dd>            <dd>注意:除主导航外不建议使用。</dd>            <dd>示例:nav>ol>li{menu$}*3</dd>        </dl>        <dl>            <dt>aside元素</dt>            <dd>描述:在article内表示主要内容的附属信息,在article外常用于侧边栏。</dd>            <dd>示例:section>article+aside</dd>        </dl>        <dl>            <dt>section元素</dt>            <dd>描述:代表文档中一个分组或分段。</dd>            <dd>注意:通常需要包含标题,可以用nav、article等的就不要用section,没有实际意义就用div。</dd>            <dd>示例:section>h1+article</dd>        </dl>        <dl>            <dt>article元素</dt>            <dd>描述:代表在页面或网站中自成一体的内容,为了独立开发或重用;例如论坛帖子,博客文章。</dd>            <dd>注意:通常需要包含标题。</dd>            <dd>示例:section>h1+article*2>h2{独立$}</dd>        </dl>        <dl>            <dt>address元素</dt>            <dd>描述:常用语联系信息,邮编地址等。</dd>            <dd>示例:address>ul>li{地址$}*2 </dd>        </dl>        <dl>            <dt>h1-h6元素</dt>            <dd>描述:标题。</dd>            <dd>注意:因为hgroup、section、article的出现,允许一个页面里出现多次h1。</dd>            <dd>示例:section>h1{section标题}+article>h1{article标题}</dd>        </dl>        <dl>            <dt>div元素</dt>            <dd>描述:一个区块,没有语义。</dd>        </dl>        <dl>            <dt>dl元素</dt>            <dd>描述:自定义列表,与dt、dd组合使用。</dd>            <dd>注意:常用于名词解释,描述。</dd>        </dl>        <dl>            <dt>ol元素</dt>            <dd>描述:有序列表,与li组合使用。</dd>        </dl>        <dl>            <dt>ul元素</dt>            <dd>描述:无序列表,与li组合使用。</dd>        </dl>        <dl>            <dt>time元素</dt>            <dd>描述:定义发布时间。</dd>            <dd>注意:time包括记起识别时间戳属性(datetime="2012-12-25"),pubdata标记(pubdata="true")属性,文本内容</dd>        </dl>        <dl>            <dt>a元素(anchor 的缩写)</dt>            <dd>描述:定义超链接。</dd>        </dl>        <dl>            <dt>em元素(emphasis 的缩写)</dt>            <dd>描述:句意强调或局部强调,改变局部侧重点。</dd>        </dl>        <dl>            <dt>strong元素</dt>            <dd>描述:表示重要,凸显关键语句。</dd>        </dl>        <dl>            <dt>p元素</dt>            <dd>描述:定义段落。</dd>        </dl>        <dl>            <dt>b元素(bold 的缩写)</dt>            <dd>描述:表示加粗,突出显示,无强调作用,常用于文档概要,评论中的关键字。</dd>        </dl>        <dl>            <dt>i元素(italic 的缩写)</dt>            <dd>描述:表示倾斜或不同于文章观点的文本,类似于话外音。</dd>        </dl>        <dl>            <dt>code元素</dt>            <dd>描述:定义计算机代码文本。</dd>        </dl>        <dl>            <dt>q元素(quote 的缩写)</dt>            <dd>描述:定义短的引用内容。</dd>        </dl>        <dl>            <dt>blockquote元素</dt>            <dd>描述:定义长的引用内容。</dd>        </dl>        <dl>            <dt>cite元素</dt>            <dd>描述:定义引用内容标题。</dd>        </dl>        <dl>            <dt>u元素(underline 的缩写)</dt>            <dd>描述:定义下划线。</dd>        </dl>        <dl>            <dt>abbr元素(abbreviation 的缩写)</dt>            <dd>描述:定义一个缩写文本,建议在abbr的title中填写全称。</dd>        </dl>        <dl>            <dt>dfn元素(defining instance 的缩写)</dt>            <dd>描述:定义一个术语。</dd>        </dl>        <dl>            <dt>var元素</dt>            <dd>描述:定义计算机代码中的变量。</dd>        </dl>        <dl>            <dt>samp元素(sample 的缩写)</dt>            <dd>描述:由程序输出的示例文本。</dd>        </dl>        <dl>            <dt>kbd元素(keyboard 的缩写)</dt>            <dd>描述:由键盘输入文本。</dd>        </dl>        <dl>            <dt>wbr元素(word break 的缩写)</dt>            <dd>描述:定义换行的时机。</dd>        </dl>        <dl>            <dt>span元素</dt>            <dd>描述:一个行内元素区域,没有语义。</dd>        </dl>        <dl>            <dt>br元素</dt>            <dd>描述:定义一个换行。</dd>        </dl>        <dl>            <dt>pre元素</dt>            <dd>描述:预格式化文本,会保留空格和换行。</dd>        </dl>        <dl>            <dt>hr元素</dt>            <dd>描述:分割线。</dd>        </dl>        <dl>            <dt>figure元素</dt>            <dd>描述:一块独立的内容,该内容被移除不会影响周围内容,常用于统计,图,音频、视频、代码片段等。</dd>        </dl>        <dl>            <dt>figcaption元素</dt>            <dd>描述:当figure需要一个标题时,用且只能用figcaption定义。</dd>        </dl>        <dl>            <dt>img元素</dt>            <dd>描述:引入一张图片。</dd>        </dl>        <dl>            <dt>iframe元素</dt>            <dd>描述:引入一张网页。</dd>        </dl>        <dl>            <dt>canvas元素</dt>            <dd>描述:用于绘画。</dd>        </dl>        <dl>            <dt>video元素</dt>            <dd>描述:引入视频。</dd>        </dl>        <dl>            <dt>audio元素</dt>            <dd>描述:引入音频。</dd>        </dl>    </article></section></body></html>

 

Statement
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
From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

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.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

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

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

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.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

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

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

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.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

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.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools