CSS learning and finishing CSS Basics (style, syntax, selectors)

Source: Internet
Author: User

  What is CSS?

    • cascading cascading Style Sheets
    • Sheet style Files
    • Style appearance personalization

  CSS syntax?

    • Declaration Method: Selector (property: Value; property: Value)
    • Selector: Define which labels are styled by name, semicolons between each pair of attributes, and colons between the attributes and values
    • CSS Comments:/* Comment content */Whether it is a single line or multiple lines, this is the only way

  CSS Basic selector?

    • Style property , inline style, written directly in the label,  style= "font-size:20px; color:blue;"
    • Tag Selector : Set style directly for HTML tags    <style type= "text/css" > p{color:red;font-size:30px;} </style>
    • ID selector : Start with # with a name beginning with a letter, case-sensitive     #test {color:red;}          <p id= "test" >hello world</p>
    • class selector : ". "begins with the class name, specification: Start with lowercase letters    .test{color:aqua;}   <p class= "test" > Hello world</p>
    • wildcard selector : *{css rule} apply the same style to the label used for the current page ( Initialization of the tag), for example: *{margin:0;padding:0;border:0}
    • Association selector : P. aa{} represents the AA class selector under P label     & nbsp;p>aa{} indicates that the child   P.AA under the P tag have both P and AA labels
    • pseudo-Class selectors: The class has a state, can be accessed by multiple elements, a hyperlink has 4 states, and other tokens can only support hover 
        li>:link    Normal link when
      • : visited has clicked the status of the access completed
      • : hover When the mouse is moved
      • : active when the mouse clicks down the state

 Categorize styles by CSS position?

    • Inline styles, starting with <style> in HTML pages
    • External styles, introducing external CSS
      • form of link: <link rel= "stylesheet" type= "Text/css" href= "Static/css/home.css" >
      • Import @import URL ("/static/css/home.css")
      • The difference between the link style and the imported style is that import can introduce styles in HTML as well as external styles in CSS style files, and link styles can only be introduced into HTML pages.

CSS Text Properties

    • Color: text color, word, 16 binary
    • Text-align: Text alignment left Right center
    • Line-height: Row height, set vertically centered, the height of the container element is consistent with Line-height
    • Text-indent: Indent, for example: 2EM
    • Letter-spacing: Word Spacing
    • Text-decoration: Text description, retouching: underline underline, overline underlined, none
    • CSS List properties: List-style:none

CSS learning and finishing CSS Basics (style, syntax, selectors)

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.