Home >Web Front-end >CSS Tutorial >Essential points for simple learning of CSS

Essential points for simple learning of CSS

不言
不言Original
2018-04-21 15:46:321338browse

The content introduced in this article is the key points of simple learning of CSS, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

Reference: http://www.w3school. com.cn/css

CSS is something that makes HTML elements display more standardized. It can be written in tags, file headers, outside files, and browser default settings (levels from high to low), Can be standardized.

Element {Attribute: value}

h1 {color:red; font-size:14px;}

Define the text color within the h1 element to red, and set the font size to 14 pixels

CSS is not case sensitive . There is one exception: when it comes to working with HTML documents, class and id names are case-sensitive.

You can group selectors so that grouped selectors share the same declaration.

h1,h2,h3,h4,h5,h6 {  color: green;  }

All title elements are green.

id selector is defined with "#"

#red {color:red;}#green {color:green;}

The first one can define the color of the element as red, and the second one can define the color of the element as green

<p id="red">这个段落是红色。</p><p id="green">这个段落是绿色。</p>

id Attributes can only appear once in each HTML document

Derived selector: define the style through the context
id selector: define the style with a specific id
# Class selector: .class name
Attribute selector: Define styles for specified attributes

External style sheet:

<head><link rel="stylesheet" type="text/css" href="mystyle.css" /></head>

           

The above is the detailed content of Essential points for simple learning of CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:css simulated planetNext article:css simulated planet