Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the HTML/CSS specifications?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly talks about "what are the HTML/CSS specifications?". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the HTML/CSS specifications?"

General style specification

Agreement

Omit pictures, styles, scripts, and the protocol portion of the other media file URL (http:,https:), unless the file is not available under either protocol. This solution is called protocol-relative URL, and the advantage is that whether you use HTTPS or HTTP to access the page, the browser will request the resources in the page under the same protocol, while saving some bytes.

/ * Not recommended * / .example {background: url (https://www.google.com/images/example);} / * Recommended * / .example {background: url (/ / www.google.com/images/example);}

General format specification

Indent

Indent 2 spaces at a time, do not use tab or mix tab and space indentation.

Fantastic Great .example {color: blue;}

Upper and lowercase

The following should be lowercase: HTML element name, attribute value (unless text/CDATA), CSS selector, attribute value.

Home

Google

/ * Not recommended * / color: # E5E5E5 * Recommended * / color: # e5e5e5

Trailing space

Ending spaces are not only redundant, but also more troublesome when comparing code.

What?_

Yes please.

General meta specification

Coding

By specifying the encoding method in HTML, you don't need to specify it in CSS, because the default is UTF-8.

Annotation

Use comments to interpret the code: the modules, functions, and benefits that are included.

Task item

Mark your to-do list with TODO instead of some other tag, such as @ @.

Apples Oranges

HTML style specification

Document type

HTML documents should use the document type of HTML5:.

Orphaned tags do not need to close themselves

Don't write it.

HTML correctness

Use the correct HTML whenever possible.

Test This is only a test. Test This is only a test.

Semantics

Choose the correct HTML element (sometimes mistakenly called a "tag") according to the usage scenario. For example, use H2 elements to create headings, p elements to create paragraphs, an elements to create links, and so on. Proper use of HTML elements is important for accessibility, reusability, and coding efficiency.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report