Getting started with the front end (upper part of CSS)

Source: Internet
Author: User

CSS styles consist of selectors and declarations, and declarations are made up of attributes and values, such as p{font-size:12px;color:red;}

Comment syntax is/* Comment statement */

Inline CSS style is to write CSS code directly in the existing HTML tags, such as <p style= "color:red;font-size:12px" > here the text is red. </p>

Embedded CSS style is to write CSS code in the head of the <style type= "text/css" ></style> tags

The external CSS style is to write the CSS code in a separate external file, then in the head import <link href= "Base.css" rel= "stylesheet" type= "Text/css"/>

The priority of the three is the nearest principle

Selector type has tag Selector, class selector (with English dot plus class name), ID selector (with # Plus ID name), child selector (first generation child element with greater than sign to specify label), descendant selector (specifies the descendant element of the label with a space)

Pseudo-class selectors can set styles for a certain state of a label, such as A:hover{color:red;}, group selectors use commas to set the same style for multiple labels

An element can have multiple classes but only one ID

Some styles of CSS are inherited, but there are some CSS styles that are not inherited

A CSS style with high weights is used, the weight of the tag is 1, and the weight of the class selector is the 10,id selector with a weight value of up to 100

Cascading is the existence of multiple CSS styles for the same element, and when a style with the same weight exists, it is determined by the sequence of these CSS styles, and the CSS style at the very back is applied

Use!important to set the highest weights for some styles, such as p{color:red!important;}

Text layout, font font-family, font size font-size, colour color, bold font-weight:bold, italic font-style:italic, underline text-decoration:underline, Delete Line Text-decoration:line-through

Paragraph layout, indentation Text-indent:2em, line spacing line-height:1.5em, letter spacing letter-spacing, word spacing word-spacing, alignment text-align

Getting started with the front end (upper part of CSS)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.