search
HomeWeb Front-endHTML TutorialNaming rules in HTML

Naming rules in HTML

Nov 20, 2017 pm 03:36 PM
htmlnamerule

We know that HTML has its strict naming rules, so today we will integrate these rules to avoid naming misunderstandings, and if you standardize the use of DIV+CSS naming rules in your web page production, you can significantly improve the optimization effect, especially When teamwork, the efficiency of collaborative production is significantly improved.

When we develop CSS+DIV web pages (Xhtml), the most confusing and tangled thing is CSS naming, especially novices who don’t know what to name and what is the best way to name it.

1. Description of naming rules: - TOP

1), all names should be lowercase

2), attribute values ​​must use double quotes ("" ), and must have a value such as class="divcss5", id="divcss5"

3). Each tag must have a beginning and an end, and must have the correct level and regular layout. Neat

4), empty elements must have an ending tag or add "/" after the beginning tag

5), performance and structure are completely separated, and no performance is involved in the code The definitions of elements, such as style, font, bgColor, border, etc.

6),

to

should follow the principle from large to small to reflect the structure of the document and facilitate search. Engine query.

7), add a unique structure tag id to each table and form

8), add alt tags to pictures

9), try to use English naming principles

10), try not to abbreviate, unless it is a word that is easy to understand at a glance

DIVCSS5 introduces common CSS naming and DIV CSS naming methods.

2. CSS style naming for important parts of the outer layer of the web page:


Coat wrap --------------- ---Used for the outermost layer

header ----------------Used for the header

main content main ---- --------Used for main content (middle)

Left main-left -------------Left layout

Right main-right -----------Right layout

Navigation bar nav ------------------Web menu navigation bar

Content ---------------Used for the middle body of the web page

Bottom footer --------------- Used at the bottom

3. DIV+CSS naming reference table: - TOP


The following is the CSS style naming and CSS file naming reference table, DIV CSS naming Collection:

CSS style naming Description

Web page public naming

#wrapper Page peripheral control overall layout width

#container or #content container, used Outermost

#layout layout

#head, #header header part

#foot, #footer footer part

#nav main navigation

#subnav Secondary navigation

#menu menu

#submenu submenu

#sideBar sidebar

#sidebar_a, # sidebar_b left or right column

#main page body

#tag tag

#msg #message prompt message

#tips tips

#vote vote

#friendlink friendlink

#title title

#summary summary

#loginbar login bar

#searchInput search input box

#hot hot spot

#search search

#search_output search output and search results are similar

#searchBar search bar

#search_results Search results

#copyright Copyright information

#branding Trademark

#logo Website LOGO

#siteinfo Website information

#siteinfoLegal Legal Statement

#siteinfoCredits Reputation

#joinus Join us

#partner Partner

#service Service

#regsiter registration

arr/arrow arrow

#guild guide

#sitemap sitemap

#list list

# homepage homepage

#subpage secondary page subpage

#tool, #toolbar toolbar

#drop drop-down

#dorpmenu drop-down menu

#status status

#scroll scroll

.tab tab page

.left .right .center left , middle, right

.news news

.download download

.banner advertising banner (top advertising banner)

Electronic trade related

.products Product

.products_prices Product price

.products_description Product description

.products_review Product review

.editor_review Editor review

.news_release Latest products

.publisher Manufacturer

.screenshot Thumbnail

.faqs FAQ

.keyword Keyword

.blog Blog

.forum Forum

CSS File Naming Description

master.css,style.css Main

module.css module

base.css is basically shared

layout.css layout, layout

themes.css theme

columns .css column

font.css text, font

forms.css form

mend.css patch

print.css print

Other instructions for CSS naming:

DIV+CSS naming summary: It doesn’t matter whether you use “.” (lowercase period) to choose a symbol to start naming, or use “#” (pound sign) to choose a symbol to start naming, but we’d better follow, the main and important The special, outermost box is named starting with the "#" (pound sign) selection symbol, and the others are named starting with the "." (lowercase period) selection symbol. Also consider the naming CSS selectorReuse calls in HTML.

Usually our most commonly used main names are: wrap (coat, outermost layer), header (header, head), nav (navigation bar), menu (menu), title (column title, general coordination h1\h2\h3\h4 tags are used)

, content (content area), footer (footer, bottom), logo (logo, can be used with h1 tags), banner (advertising banner, usually at the top ), copyRight (copyright). Others can be used selectively according to your own needs.

DIVCSS5 recommendation: The main, important, and outermost boxes should be named starting with the "#" (pound sign) selection symbol, and the others should be named starting with the "." (lowercase period) selection symbol.

2. The CSS style file is named as follows


Main master.css

Layout, layout.css

Columns columns.css

Text font.css

Print style print.css

Theme themes.css

4. English naming skills:


If you encounter something that is not commonly used, you can use a translation tool to translate it and give it an English name.

It is recommended to use the Google online translation tool: http://translate.google.cn/


Standardized CSS naming brings many benefits, I hope everyone Strictly abide by the naming rules to make it convenient for you, me and others.

Related reading:

How HTML calls CSS to manage and beautify divs

css+div typical layout basic framework

Example showing DIV+CSS implementation of radio station list

The above is the detailed content of Naming rules in HTML. For more information, please follow other related articles on the PHP Chinese website!

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
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

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.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

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.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

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

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

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.

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.

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 Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

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),

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

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.