CSS style selector

高洛峰
Release: 2017-02-14 15:04:32
Original
1654 people have browsed it

css is the abbreviation of English Cascading Style Sheets, which is called cascading style sheets and is used to beautify the page. There are three ways of existence:

element inline, page embedding and external introduction. Compare the advantages and disadvantages of the three methods.

Syntax: style='key1:value;key2:value2;'

Use style='xx:xxx;'

In the tag, embed in the page: < ;style type='text/css'>block

Introducing external css files


##Necessity: The artist will edit the page The developer is responsible for color matching and beautification of images, and must know how to achieve it.


Look at how to use the above three methods:

1. Use Block

    页面一   
  
123456
aaa
Copy after login

in the page, that is, add a < in the code ;style>Code block, customize a style, and then call it repeatedly in the subsequent code


##3. Introduce external css files

If there are multiple html files that need to reference custom css styles, then according to the second method, you need to define a style in each html file. In order to solve this problem, you can define a file and write custom style, and then call this style from the file. How to write

style:

Copy after login

1. When the class selector

.logo indicates class='logo', quote the style


2. ID selector

#When logo indicates id='logo', reference this style


3. Combination selector The selector

a, div means that all a tags and div tags refer to this style


4. The associated selector

a div Represents a hierarchical relationship, that is, all div tags below the a tag apply this style.


5. Attribute selector

input[type='text'], attribute label, indicating that all labels of type 'text' refer to this Style



6, .logo a, .logo p means when class='logo', all the following a tags and when class='logo', all the following p tag, refer to the style

For more CSS style selector related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!