CSS style specifications 1. Class Selector 2. Tag selector 3. ID selector 4. CSS style child selector Class Selectors 1. The fixed structure that must be memorized becomes a CSS style tag. All styles can be written in CSS style tags <style type="text/css"> </style> 2. type="text/css" means declaring this tag as a CSS style type type: type means 3. Class selector syntax format. Class name (dot plus class name) Write location: Call the method in the CSS style tag and write class=class name inside the HTML tag 4. Naming conventions It is recommended to use pure letters or letters followed by numbers. Do not start with numbers. Although other names can be used, please ask how to use them. 5. Why should we extract the inline CSS into the CSS tag? Advantage 1: Keep HTML hierarchy clear and easy to detect errors Advantage 2: CSS styles can be reused XML/HTML CodeCopy content to clipboard
ID Selector 1. The syntax format of ID selector is #ID name Write location: Call the method in the CSS style tag and write id="ID name" inside the HTML tag The same reason as the class name in the previous section 3. Why extract inline CSS into CSS tags Advantage 1: Keep HTML levels clear and easy to detect errors Advantage 2: Distinguish priorities. If you need to reuse, please choose a class selector 4. ID does not allow repeated calls. ID is like an ID card number. Each one is different. XML/HTML CodeCopy content to clipboard
Tag name selector When multiple tags use the same attribute, they can be written as a selector. All the following tags share this attribute XML/HTML CodeCopy content to clipboard
CSS style child selector XML/HTML CodeCopy content to clipboard
2. Style Priority 1. CSS execution order. Under the same priority, if the next line of CSS conflicts with the previous line of CSS, the next line will be the standard In case of different priorities, the higher priority overrides the lower priority. 2. Selector priority order First place: Inline style 1000; 3. Things to note: When the CSS you wrote doesn't work, first check if the code is wrong and then check if the priority is wrong. XML/HTML CodeCopy content to clipboard
The above is all the content of the must-read article on HTML (css style specifications) brought to you by the editor. I hope you will support 123WORDPRESS.COM~ Original address: http://www.cnblogs.com/pythonxiaohu/archive/2016/06/25/5616511.html |
<<: 5 tips for writing CSS to make your style more standardized
>>: MySQL tutorial DML data manipulation language example detailed explanation
environment: 1. Windows Server 2016 Datacenter 64...
background Use idea with docker to realize the wh...
In JavaScript's DOM event model, events are r...
1. Introduction The ls command is used to display...
Table of contents 1 Introduction to the new opera...
Table of contents Set a not null constraint when ...
1. Percentage basis for element width/height/padd...
WebService Remote Debugging In .NET, the remote d...
Today I used a virtual machine to do an experimen...
The value of the background property in CSS backg...
KVM stands for Kernel-based Virtual Machine, whic...
Dynamically adding form items iview's dynamic...
Preface We may have heard of the concept of rowid...
Table of contents Preface Active withdrawal Excep...
Preface We often say that node is not a new progr...