I used a CSS layout to design a web page, and found that my naming was a bit confusing. I named it exactly according to my own ideas. Although it has no impact, I don’t show the source file to others, but the studio sometimes cooperates with the team to complete the project. When I was working on it, I ran into trouble. It was quite troublesome to modify a place. So it is better to have a standard!
I saw a related reference on the Internet, plus I also study other people’s code in my daily life, and found that Such naming is widely used! I added my own experience and hope it will be useful to people who read this article!
Naming convention
Commonly used CSS naming rules:
Header: header
Content: content/container
Tail: footer
Navigation: nav
Sidebar: sidebar
Column: column
Page peripheral control overall layout width: wrapper
Left right center: left right center
Use all lowercase letters for naming. If multiple words are needed, use "-" to separate the words, such as user-list
Common code structure:
div: mainly used for layout, dividing the structure of the page
ul/ol: used for unordered/ordered lists
span: has no extraordinary meaning and can be used as an auxiliary for typesetting, such as
Example Source Code [www.mb5u.com]
Then define span in css to float to the right, so that the date and title can be displayed on both sides Effect
h1-h6: Title
h1-h6 in descending order according to importance
h1 most important title
label: In order to make your form more friendly and also Good things that can assist in form layout, such as:
Example Source Code [www.mb5u.com]
fieldset & legend: fildset is outside the form , legend is used to describe the form content. For example:
Example Source Code [www.mb5u.com]
dl,dt,dd: When the first line appears on the page, it is similar to a title/brief description, and then the following is a specific description This tag should be used when containing content, such as
Example Source Code [www.mb5u.com]
- What is CSS?< ;/dt>
- CSS is a technology called stylesheet. Some people also call it Cascading Stylesheet.
- What is XHTML?
- XHTML is an XML-based markup language that looks similar to HTML, with only some small but important differences. You can look at it this way, XHTML is XML that plays a role similar to HTML. In essence, XHTML is a bridging (transition) technology that combines the power of XML (somewhat) with the simplicity of HTML (mostly).
Example Source Code [www.mb5u.com]
C #content
S #subcol
M #maincol
X #xcol
This is the XHTML structure for portrait layout, c- smx means that the web page has three columns, c-sm means there are two columns, c-mx means there are two columns, one of which is attached, and c-m means one column.
The three-column layout needs to be divided into two layers. The first layer is #subcol and #main. The second layer is #maincol and #xcol in #main.
Custom naming:
According to the w3c website, it is best to name with meaning
For example: important news is highlighted (like red)
There are two kinds
Example Source Code [www.mb5u.com]
.red{color:red}
.important-news{color:red}
Mb5U.com - Template Wuyou
Obviously the second one conveys a clearer meaning, so try not to use an unclear meaning as your own custom name.

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

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 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.

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 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.


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

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.

Zend Studio 13.0.1
Powerful PHP integrated development environment

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

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

WebStorm Mac version
Useful JavaScript development tools
