The first chapter on CSS Learning

Source: Internet
Author: User
Tags set background

1, CSS Three kinds of writing way: embedded, outside the chain, in-line

Embedded is the CSS write in <style></style>

outside the chain will be the outside CSS files are linked by tags in HTML : <link rel= "stylesheet" type= "Text/css" href= " external CSS The address of the file "/>

Inline: Is the CSS code written in < tag style="CSS code "/>

2. CSS selector: basic selector, composite selector, pseudo class selector, property selector

The basic selector is also divided into: Universal selector, Tag Selector, ID selector, class selector .

    Universal Selector : *{declaration statement; it sets the style for all tags in HTML, which increases the burden on large Web sites and is not recommended.

Tag Selector : tag name { declaration statement ; Statement Statement ;}  

    class selector : The attribute value of the . Class { declaration statement ; Statement Statement ;} Common

ID Selector : The property value of the #id { declaration statement ;}

The composite selector is divided into: Combo selector: selector 1, selector 2, selector 3, selector n{ declaration statement; Declare statement} to set the style for the selector in the list at the same time

Descendant element selector: ancestor element descendant element { statement 1; Statement 2;} matches all descendant elements specified below the ancestor element to set the style

           child element Selector : parent element > child element { statement 1; Statement 2;} matches the specified child element below the parent element to set its style

           adjacent element selector : E + f{ Format declaration statement ;} Match E element below the F element, two elements must be next to each other

Pseudo-class selectors are used to set styles for different states of hyperlinks : a:link,a:visited{ Sets the color of hyperlinks ; Remove Underline ;} set pre-and post-access status

a:hover{ Set the color of the hyperlink ;} Set the state of the mouse on

3. List Style properties: List-style-type items before the modified list composite: none (None), disc (solid circle), Circle (Hollow Circle), Square (small square)

List-style-position setting the position of the pre-list symbol: Inside (inside), outside (on the outside, default value)

List-style-image set the pre-list symbol to Picture:list-style-image: url (picture path)

List-style Shorthand property: List-style:none url (picture path) inside

4. Inheritance and precedence: inline style >id selector > class selector > Tag Selector

5,!     Important: The weight value of the promoted attribute infinite format: attribute : attribute value !important; IE6 Browser does not support

6. Background style properties: Background-color set background color; Background-image Set background image, Background-repeat set background picture status: No-repeat (Uneven), repeat-x ( Tile horizontally),

Repeat-y (tile vertically), background-position: horizontal position or vertical position (set picture position) There are 3 ways of expression: English words, fixed values, percentages;

Background : Shorthand property, you can have multiple values ( to set the background color and background picture for an element if the element has height and width or content.)

The first chapter on CSS Learning

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.