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
The Future of HTML: Evolution and TrendsThe Future of HTML: Evolution and TrendsMay 13, 2025 am 12:01 AM

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

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.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

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.