In an HTML page with a lot of content, it is necessary to design many different frames, and then classify these different frames and content and give them corresponding names, so as to make the structure of the web page clearer and provide convenience for work. When many novice friends design an HTML file, they may only give some simple names based on their own ideas. However, if they blindly give random names, it will not only make it difficult for team members to understand, but also lead to confusing label names. It will make code maintenance very difficult and very unfavorable for management. Therefore, when designing the entire website or a separate HTML page, we should have good naming rules. In this article, we mainly explain CSS naming rules, which also includes naming HTML tags.
The file name must start with an English letter. The usual naming rule is to translate it into English words and name them according to the classification of the content and the type of the frame. For example: div id="nav" (meaning that this div is a navigation bar ), all words should be in lowercase letters, and numbers or underlines can be used in the name, for example: div="main_piclist" (representing the picture list under the main content), div="nav_bg.jpg" (representing the background image of the navigation bar) , you can also use the dash to connect the names, for example: div="main-left" (indicating the layout of the content on the left) All names should try to avoid using Chinese characters, and use the fewest letters to achieve the easiest to understand Unless the meaning is easily understood at a glance, try not to abbreviate it.
HTML tag naming/CSS standardized naming collection
Page structure naming
- ##page: Represents the entire page and is used for the outermost layer.
- wrap: coat, a peripheral package that wraps all elements together, used for the outermost layer
- wrapper: page peripheral control overall Layout width, used for the outermost layer
- container: an overall container, used for the outermost layer
- head, header: header area , used for the header
- nav: navigation bar
- content: content, the most important content area in the website, used for the middle body of the web page
- main: The main area in the website (indicating the most important position), used for the central main content
- column: Column
- sidebar: sidebar
- foot, footer: footer, footer. Some additional information placement areas on the website, (or named copyright) are used at the bottom
navigation naming
- ##nav, navbar, navigation, nav-wrapper: navigation bar or navigation package, representing horizontal navigation
- topnav: top navigation
- mainbav: main navigation
- subnav:Sub navigation
- sidebar:Side navigation
- ##leftsidebar or sidebar_a:Left navigation
- rightsidebar or sidebar_b: right navigation
- title: title
- summary: summary/li>
- menu: Menu. Area contains general links and menus
- submenu: submenu
- drop: dropdown
- dorpmenu: drop-down menu
- links: link menu
- Function naming
logo: mark the website logo
- banner: slogan, advertising banner, top advertising banner
- login: login, (such as login form :form-login)
- loginbar:Login bar
- regsiter:Registration
- tool, toolbar: Toolbar
- search: Search
- searchbar: Search bar
- searchlnput: Search Input box
- shop: ribbon, indicating the current
- icon: small icon
## label: Trademark
homepage: Homepage
subpage: Secondary page subpage
hot : Hot spots
list: Article list, (for example, news list: list-news)
scroll: Scroll
tab: tag
sitemap: website map
- ##msg or message: prompt message
- current: current
- joinus: join
- status: status
- btn: Button, (for example, the search button can be written as: btn-search)
- tips: Tips
- note: Note
- guild: guide
- arr, arrow: mark arrow
- service: service
- breadcrumb: (i.e. the navigation prompt of the page location)
- download:Download
- vote:Vote
- siteinfo: website information
- partner: partner
- link, friendlink: friend link
- copyright: Copyright information
- siteinfoCredits: Credibility
- siteinfoLegal: Legal information
CSS style naming
Alignment style naming: left (left content), center (middle content), right (right content) ), etc.;
English naming of colors: red (red), green (green), yellow (yellow), or border_red (red border), etc.;
Color code naming: f00 (red), ff0 (yellow), f90 (orange), etc.;
Text size naming: font12px (font 12 pixels), font16px ( Font 16 pixels), etc.;
Page line naming: line_x (horizontal line), line_y (vertical line) or line_red (red line), line_black (black line)
Picture icon naming: pic_1.jpg, pic_2.jpg or ico_1.gif, ico_2.gif
- ##Page advertising naming: ad_01, ad_02
- Background frame naming: nav_bg (represents the position of the background image of the navigation bar), tool_bg (represents the position of the background image of the toolbar)
CSS style sheet naming
- index.css: Create a separate style for the homepage
- head.css: Head style, multiple page head design Used when the styles are the same.
- base.css: shared style.
- style.css: Style file used by independent pages.
- global.css: page style base, global public style, must be included in the page.
- layout.css: layout, layout style, used when there are many common types, generally used in homepage pages and product pages
- module.css: module, used for product pages, and can also be used with other styles.
- master.css: Main style sheet
- columns.css: Column style
- themes.css: Body style
- forms.css: Form style
- mend.css: Patch, privatized patch based on the above style .
The above is the detailed content of HTML\CSS standardized naming list. For more information, please follow other related articles on the PHP Chinese website!

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.

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.

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

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

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.

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.


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

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

Hot Article

Hot 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 Mac version
God-level code editing software (SublimeText3)

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

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools
