Home > Web Front-end > CSS Tutorial > A thorough study of CSS (1)

A thorough study of CSS (1)

黄舟
Release: 2016-12-22 16:25:29
Original
1338 people have browsed it

CSS thorough research (1)

Github pages blog post

Basic selector

Mark selector h1 {...}

category.class_name{...}, two classes work at the same time, such as class = 'one two', in case of conflict, choose the former

ID selector #id{...}

Compound selector: two or more selectors, connected in different ways

Intersection

h3.class_name { ... }

The first one must be a tag selector, the second one must be (category selector) or (ID selector), there is no space in the middle, it must be written continuously

The union selector a_selector, b_selector is multiple Selector

Descendant selector

div p { /* p below div, including all descendants*/}

div>direct descendants of pdiv

CSS inheritance

The contained small container will inherit the containing it The style of the large container

ABCD

h1{ color : red; text-decoration : underline;}em { color : blue;}

The result is as follows Figure, em inherits the underline of h1

CSS priority

inline style (style=) > ID style (#id) > class style (.class) > mark style (div)

two classes conflict When choosing, choose the former

The above is the content of CSS thorough research (1). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
css
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template