


Project review summary 3: CSS introduction method, comments, naming conventions, background, line height, text attributes_html/css_WEB-ITnose
Directory:
2. Various advantages and disadvantages of CSS introduction methods
6. All attributes such as text (starting with text and font) |
行注释 | // 这是行注释,注意'//'后面有空格 /* 这是一段注释 */ |
块注释 | /* * 注释以一行(*后面记得有空格) * 注释以二行(*后面记得有空格) * 注释以三行(*后面记得有空格) */ |
① CSS comment writing specifications: 1. Single-line comments: is written directly after the attribute value, such as:
|
② Benefits of writing CSS comments: 1. Use comments to quickly locate complex problems In the code page, styles can be written efficiently, making the code hierarchy clear and modifications more intuitive. 2. CSS annotations (css annotations) can help us explain the CSS files we write, such as explaining the location, function, style, etc. of a certain piece of CSS code, so that we can maintain it at a glance in the future. It is convenient to understand. At the same time, when the team is developing web pages, reasonable and appropriate annotations will help the team understand where the css style corresponds to the html, so that the web page can be developed smoothly and quickly. |
Line comment | // This is a line comment, please note There is a space after '//' /* This is a comment */ |
Block comment | 🎜> * Comments should be in three lines (remember to have spaces after *) */ |
Extension: HTML structure Annotation method
Use
|
Various advantages and disadvantages of CSS introduction methods
① External introduction : The most widely used, one css file can control multiple pages. From the perspective of the entire site, it reduces the number of codes, improves loading speed, and facilitates Maintenance ③ written inside the tag : less used, with the highest weight, a lot of code, slow loading, not conducive to maintenance :
|
Selector type: ① Tag name selection ② ID name selector ③ Class selector ④ Descendant selector ⑤ Group selector ⑥ Pseudo-class selector ⑦ Attribute selector ⑧ Wildcard ⑨ Descendant selector Selector priority: ① Priority of different CSS introduction methods: tag inline style > Header writing style > External reference style > Browser default style . ② CSS selector priority: id > class > tagname. ③ Multiple selections Priority when servers are mixed: Example.a .b c{} and .a c{}, they both point to c, but the former has a higher priority than the latter. Note: When the priorities of selectors pointing to the same target are the same, the later priority is greater than the previous priority; when in the same tag When multiple class names are defined, the priority between each class selector has nothing to do with the arrangement of class names in the HTML, but is related to the arrangement of each class selector in the CSS file. |
CSS naming convention
1. In the naming of rules, always use lowercase letters plus middle letters. The way of underlining is not allowed to use capital letters or _
3. Pay attention to abbreviations when naming, but do not abbreviate blindly 6. ID is used to identify a certain parent container area of a module or page. The name must be unique and not arbitrary. Create a new id 7. Class naming must be concise and concise 8. In addition to resetting the browser default style, it is prohibited to directly add css style settings to html tags, for example: div { width:200px;height:100px;}9. Each rule should ensure that the selector is unique, and it is prohibited to directly set attributes for global .nav/.header/.body and other classes |
For details, see: Lonely Binghai-CSS Coding Specification
1、 区分大小写 2 、 首写符必须是字母,下划线( _ )或者美元符($) 3、 除首字母外的字符,可以由字母,数字,下划线,美元符号组成 4、 不允许包含空格 |
Extension: JS Naming Specification
3. Except the first letter Characters outside of > background背景 属性: CSS3新增的属性: Background syntax: [For details, please see blog background image merging knowledge] background-color: red | #RGB; background-position: X-axis coordinate Y-axis coordinate | left | right | center | top.. background-size: 100px | 30% | cover | contain; background:color url() positon repeat; Note: If the attribute value of background-size only sets one value, the second value will be set to "auto". cover: Expand the background image to a large enough size so that the background image completely covers the background area. contain : Expand the image to its maximum size so that its width and height fit completely within the content area line-height line-height attribute: Set the distance between lines (line height). Syntax: line-height : normal | Detailed explanation of line-height CSS text property
1. Case sensitive 2. The first letter must be a letter, underscore (_) or dollar sign ($)
* background-color
* background-position
* background-size
* background-repeat
* background-origin
* background-clip
* background-attachment
* background-image
属性 浏览器支持 background-size background-origin
Background, line height attributes background-clip
background background Attributes: * background-color * background-position * background-size * background-repeat * background-origin * background-clip * background-attachment * background-image New attributes in CSS3:
Property browser support background-size td>
background-origin
background-clip
CSS 文本属性
属性 描述 color 设置文本颜色 direction 设置文本方向。 line-height 设置行高。 letter-spacing 设置字符间距。 text-align 对齐元素中的文本。 text-decoration 向文本添加修饰。 text-indent 缩进元素中文本的首行。 text-shadow 设置文本阴影。CSS2 包含该属性,但是 CSS2.1 没有保留该属性。 text-transform 控制元素中的字母。 unicode-bidi 设置文本方向。 white-space 设置元素中空白的处理方式。 word-spacing 设置字间距。
Property description
color
Set text Color
direction
Set the text direction.
属性 描述 font 简写属性。作用是把所有针对字体的属性设置在一个声明中。 font-family 设置字体系列。 font-size 设置字体的尺寸。 font-size-adjust 当首选字体不可用时,对替换字体进行智能缩放。(CSS2.1 已删除该属性。) font-stretch 对字体进行水平拉伸。(CSS2.1 已删除该属性。) font-style 设置字体风格。 font-variant 以小型大写字体或者正常字体显示文本。 font-weight 设置字体的粗细。
line-height Set the line height.
letter-spacing
Set character spacing.
text-align
Align text within an element.
text-decoration
Add decoration to text.
text-indent
Indent the first line of text in the element.
text-shadow
Set text shadow. CSS2 includes this property, but CSS2.1 does not retain it.
text-transform
Controls the letters in the element.
unicode-bidi
Set text direction.
white-space
Sets how whitespace in elements is handled.
word-spacing
Set word spacing. CSS font property
Property description
font
Abbreviation attribute. The function is to set all font-specific properties in one statement.
font-family
Set the font family.
font-size
Set the font size.
font-size-adjust
Smart scaling of replacement fonts when the preferred font is unavailable. (This property has been removed in CSS2.1.)
font-stretch
Stretch the font horizontally. (CSS2.1 has removed this attribute.)
font-style
Set the font style.
font-variant
Display text in small caps or normal font.
font-weight
Set the weight of the font.

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.

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.

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

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.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.


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

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

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