What Beautiful HTML Code Looks Like How to write beautiful HTML code. An article written by a foreigner: What Beautiful HTML Code Looks Like How to write beautiful HTML code feels very well written, so I reposted it and shared it with you: ps: Original address: http://css-tricks.com/what-beautiful-html-code-looks-like/ 1. DOCTYPE Properly Declared Don't forget the header declaration, which tells the browser how to render your HTML. 2. Tidy Head Section Set the title and character set. Link the CSS and JS to external links (including a CSS for printing). 3.Body IDed Give the body an ID. The reason mentioned by the author here is to facilitate the selection of containers in multiple pages. For example, by setting different IDs for BODY in page1 and page2, you can set two different effects through #page1 h2 and #page2 h2. I feel that this depends on the situation and the specific architecture. 4.Semantically Clean Menu Write semantic menu code. <div id="menu"> 5.Main DIV for all Page Content There should be a main DIV that contains all the content. It is convenient to fix the width, margins, etc. of the subject. 6. Important Content First Write the main content first, then the secondary content. If your navigation or sidebar is not very important, it is best to write them last. 7. Common Content Included Import common parts such as navigation and footer through dynamic calls, such as PHP include. 8.Code is Tabbed into Sections Indent code 9.Proper Ending Tags Note the closing tag 10.Hierarchy of Header Tags Use heading tags, such as <h1>~<h6>, to divide paragraphs where appropriate. 11. Content, Content, Content Use appropriate labels and sign codes, use & copy; to indicate ©, and do not use </br> 12.No Styling! Don't put styles in tags; HTML is only used to represent structure. Let CSS handle the performance. ![]() |
<<: Quickly get started with VUE 3 teleport components and usage syntax
>>: How to implement dynamic automatic up and down of upstream servers without reload based on nginx
Table of contents Debounce Throttle Summarize Deb...
This article shares the specific code of js to re...
1. Packetdrill compilation and installation Sourc...
In the past, creating a printer-friendly version ...
1. Background I recently made a website, uidea, w...
1. Docker pulls the image docker pull mysql (pull...
Table of contents Overview Index data structure B...
1. Implementation ideas The purpose of interface ...
1. Nginx status monitoring Nginx provides a built...
1. Prerequisites We use the require.context metho...
This article was originally written by blogger We...
Table of contents 1. Why NanoID is replacing UUID...
The <base> tag specifies the default addres...
This article introduces an example of using HTML+...
BFC Concept: The block formatting context is an i...