Html
Css
- Use two spaces instead of tabs (tab)-This is the only way to ensure consistent presentation in all environments.
- When grouping selectors, separate selectors are placed on a single line.
- For readability of the code, add a space before the left curly brace of each declaration block.
- The closing curly brackets of the declaration block should be taken separately.
:
a space should be inserted after each declaration statement.
- For a more accurate error report, each statement should be exclusive to one line.
- All declaration statements should end with a semicolon. The semicolon after the last declaration statement is optional, but if you omit the semicolon, your code may be more prone to errors.
- For comma-separated property values, you should insert a space after each comma (for example,
box-shadow
).
- Do not
rgb()
rgba()
insert spaces After the,,,, or the hsl()
hsla()
rect()
comma inside the value. This makes it easy to distinguish multiple color values (with commas and no spaces) from multiple attribute values (plus commas and spaces).
- For attribute values or color parameters, omit 0 (for example, instead of a decimal
.5
0.5
-.5px
-0.5px
) that is less than 1.
- Hexadecimal values should all be lowercase, for example,
#fff
. When you scan a document, lowercase characters are easy to distinguish because their form is easier to distinguish.
- Try using a shorthand hexadecimal value, for example,
#fff
instead #ffffff
.
- Add double quotation marks to the properties in the selector, for example,
input[type="text"]
. Only in some cases is optional, but for code consistency, it is recommended that you add double quotes.
- Avoid specifying units for 0 values, for example, with
margin: 0;
Replacemargin: 0px;
。/*CSS that does not conform to the specification*/. Selector,. Selector-secondary,. Selector[type=text]{padding:15px;margin:0px 0px 15px;Background-color:rgba (0, 0, 0, 0.5);Box-shadow:0px 1px 2px #CCC, inset 0 1px 0 #FFFFFF}/*code-compliant CSS*/. Selector,.selector-secondary,.selector[type= "text"]{padding:15px;Margin-bottom:15px;Background-color:Rgba (0,0,0,.5);Box-shadow:0 1px 2px #ccc, inset 0 1px 0 #fff;}
- The related attribute declarations should be grouped into groups and arranged in the following order:
Because positioning (positioning) removes elements from the normal flow of documents and also overrides the box model-related styles, it is ranked first. The box model is ranked second because it determines the size and position of the component.
Other properties only affect the interior of the component (inside) or do not affect the first two sets of properties, so it is followed.
- Positioning
- Box model
- Typesetting
- Borders and backgrounds
- Transparency
- Example:
. Declaration-order{/*positioning*/position:Absolute;Top:0; Right:0;Bottom:0; Left:0;Z-index: -;/*Box Model*/Display:Block;float: Right;width:100px;Height:100px;/*Typesetting*/Font:normal 13px "Helvetica Neue", Sans-serif;Line-height:1.5;Color:#333;text-align:Center;/*borders and Backgrounds*/Background-color:#f5f5f5;Border:1px solid #e5e5e5;Border-radius:3px;/*Transparency*/Opacity:1;}
A matter of opinion, the so-called norm is everyone agreed how to write code.
This is all on the internet, and I watched it all over again. Do not know whether to declare reprint, some or reproduced reprint, too troublesome, anyway are some of the basic things, just forget it.
HTML and CSS Coding specifications for "Bootstrap basic Learning" bootstrap