HTML Note 3

Source: Internet
Author: User

CSS one, review 1. What is CSS?

Cascading Style Sheets: cascading styles are only overwritten and not replaced

2. How CSS is used

Style Properties--->

Style tags---->head标签里面

Link---><link rel="stylesheet" href="style.css">

3. Base Selector

HTML Tag Selector

通过html标签名来选择元素① 所有的html标签都可以当做选择器② 无论标签藏多深都会被选中③ 选择的是所有的标签而不是具体某个标签。所以说我们通过html标签选择器来设置的都是一些共性问题。

ID Selector

① 任何的标签都可以有id属性和属性值(因为id是一个全局属性)。id命名不能随意的命名。大小写敏感 ,id的名字中可以有数字字母下划线,但是要以字母开头。    驼峰命名法 小驼峰命名  大驼峰命名         testHeader 小驼峰  TestHeader 大驼峰         

Class Selector

① 任何的标签都可以使用class属性(class属性也是一个全局属性) ② class属性名可以重复使用 ③ 一个class属性中,可以有多个class属性值。

=======================

Second, integrated selector
    1. Descendant selector Div p
    2. Intersection selector DIV.D1
    3. Set Selector div,p
    4. Child element Selector Div>p
    5. Sequence Selector ul Li:first-child Ul:li:last-child
    6. Neighboring brother selector Div + P
    7. Ordinary brother selector Div ~ P
Third, inheritance and Cascade 1. Inherited

Some CSS properties of the parent element will inherit the past with the quilt element unconditionally. CSS properties on text can be inherited:color text- line- font-

2. Cascade

Cascading solves the problem of CSS conflicts.

Compare weights to solve cascading problems.

!important can change the weight of the "individual attribute" to infinity. Use as little as possible.

Block-level elements and inline elements

divBlock-level elements

spanIn-line elements

The difference between a block-level element and an in-line element:

1. 行内元素部不能够设置宽度和高度。行内元素的宽度和高度是标签内容的宽度和高度。块级元素可以设置宽度和高度。2. 块级元素会独占一行。而行内元素却部能够独占一行,只能和其他的行内元素共用一行。3. 如果块级元素不设置宽度,那么块级元素会自动的沾满父元素的全部宽度。

Conversion between block-level elements and inline elements

Display:inline Block Inlin-block

HTML Note 3

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.