


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.

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



Share the simple and easy-to-understand PyCharm project packaging method. With the popularity of Python, more and more developers use PyCharm as the main tool for Python development. PyCharm is a powerful integrated development environment that provides many convenient functions to help us improve development efficiency. One of the important functions is project packaging. This article will introduce how to package projects in PyCharm in a simple and easy-to-understand way, and provide specific code examples. Why package projects? Developed in Python

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

Title: Learn more about PyCharm: An efficient way to delete projects. In recent years, Python, as a powerful and flexible programming language, has been favored by more and more developers. In the development of Python projects, it is crucial to choose an efficient integrated development environment. As a powerful integrated development environment, PyCharm provides Python developers with many convenient functions and tools, including deleting project directories quickly and efficiently. The following will focus on how to use delete in PyCharm

PyCharm is a powerful Python integrated development environment that provides a wealth of development tools and environment configurations, allowing developers to write and debug code more efficiently. In the process of using PyCharm for Python project development, sometimes we need to package the project into an executable EXE file to run on a computer that does not have a Python environment installed. This article will introduce how to use PyCharm to convert a project into an executable EXE file, and give specific code examples. head

How to Make a GroceryList on iPhone in iOS17 Creating a GroceryList in the Reminders app is very simple. You just add a list and populate it with your items. The app automatically sorts your items into categories, and you can even work with your partner or flat partner to make a list of what you need to buy from the store. Here are the full steps to do this: Step 1: Turn on iCloud Reminders As strange as it sounds, Apple says you need to enable reminders from iCloud to create a GroceryList on iOS17. Here are the steps for it: Go to the Settings app on your iPhone and tap [your name]. Next, select i

PyCharm is a powerful Python integrated development environment (IDE) that provides rich functions to help developers write and manage Python projects more efficiently. In the process of developing projects using PyCharm, sometimes we need to delete some projects that are no longer needed to free up space or clean up the project list. This article will detail how to delete projects in PyCharm and provide specific code examples. How to delete a project Open PyCharm and enter the project list interface. In the project list,

IDEA (IntelliJIDEA) is a powerful integrated development environment that can help developers develop various Java applications quickly and efficiently. In Java project development, using Maven as a project management tool can help us better manage dependent libraries, build projects, etc. This article will detail the basic steps on how to create a Maven project in IDEA, while providing specific code examples. Step 1: Open IDEA and create a new project Open IntelliJIDEA

Variable naming conventions you need to know when learning Python An important aspect when learning the Python programming language is learning how to name and use variables correctly. Variables are identifiers used to store and represent data. Good variable naming conventions not only improve the readability of your code, but also reduce the possibility of errors. This article will introduce some commonly used variable naming conventions and give corresponding code examples. Use Meaningful Names Variable names should have a clear meaning and be able to describe the data stored in the variable. Using meaningful names allows it to
