【Front-end】#001 Coding specification_html/css_WEB-ITnose
HTML coding style:
Document type: HTML5 type
<!doctype html>
<strong> 编码:</strong> 使用 meta 设置编码类型 UTF-8
<!doctype html>
<html>
<head>
<metacharset="utf-8">
</head>
<body>
</body>
</html>
<strong>大小写:</strong>除了 Text CDATA元素,其他都使用小写
<strong>缩进:</strong>整个文件要统一(具体看情况使用 2、4空格)
换行:出现块级元素(div、p),列表元素(ul,ol),表格元素(table) 换行,行内元素大于80换行
<strong>编程风格</strong>
- Strictly use closing tags to avoid nesting errors
- Do not mix JS, CSS, and HTML (extract CSS and JS)
- img, object Tags should use alt attributes
- button, input and other form tags. Remember to add the title attribute
- to simplify statements that reference CSS and JS
<!-- 不推荐 ?>
<linkrel="stylesheet"href="//www.google.com/css/maia.css"type="text/css">
<!-- 推荐 ?>
<linkrel="stylesheet"href="//www.google.com/css/maia.css">
<!-- 不推荐 ?>
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"type="text/javascript"></script>
<!-- 推荐 ?>
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"></script>
6. Prioritize the use of button tags instead of
7. The html tag must set the title attribute
CSS development specifications
- Encoded character set: UTF-8 (no BOM), saved as CSS file
- Must be written in lowercase letters
- Use meaningful short words for naming (or team norms)
- Add a space after the colon
- The selector and each attribute occupy one line each (selectors and curly braces do not need to be on a new line)
- Indentation: Fixed use 2 / 4 spaces, do not use the tab key
- A blank line between the selector name and the selector name (a blank line between the two style selectors)
- Each style needs to end with a semicolon Separate
/* 不推荐 */h3{ font-weight:bold;}
/* 推荐 */h3 { font-weight: bold;}
/* 不推荐 */a:focus, a:active { position: relative; top: 1px; }/* 推荐 */h1,h2,h3 { font-weight: normal; line-height: 1.2;}
Writing order
css It should be written in the following order. The principle is positioning and layout first, details second
- display mode display
- positioning or floating mode position, float, clear
- Up, down, left and right positioning offsets left, top, right, bottom
- Height and width dimensions height, width
- Inner and outer padding margin, padding
- Border border
- Background
- Color color
- Font text font
- Text line-height, text-align
- Other miscellaneous
Z-index usage specifications
In principle, module css must comply with the following specifications when using absolute positioning, but it is not enforced. During the development process, use less absolute positioning layout and more use the layout manager to manage the layout.
- Map: The index range used is from 0-99, including tile maps, custom layers, legends, layer management, etc.
- Interface business Module: The used index ranges from 100-199, real-time water conditions list, etc.
- Footer: The used index range is from 700-799, including copyright, filing, Technical support, etc.
- Navigation: The index range used is from 800-899, including logo, system name, navigation bar, etc.
- Pop-up box: The index range used is from 900-999, including settings panel, prompt box, etc.

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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

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

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

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.
