HTM L+CSS Basic Knowledge points

Source: Internet
Author: User

1, the structure of HTML production page, composed of head and body.

2, CSS for the page display style, you can control the location of the elements in the page, color, size and so on.

3. HTML code Comment Method <!--code comment section--

4

5. CSS Comment method:/*css code Comment */

6, CSS style Add way: (1) direct to style= "color:red;" Added in the label (inline style). (2) in head

7, Style priority: inline > Embed > External. When you have more than one embedded style for the same selector, follow the last style. You can also increase the priority by adding!important after the property value.

8, CSS selector: (1) Tag Selector q{}, Weight 001. (2) class selector. class{}, weight 010. (3) ID selector #id{}, weight 100. (4) Sub-selector p>span{}. (5) descendant selector P span{}. (6) Universal selector *{}. (7) Pseudo-class selector a:hover{};a:link{};a:actived{};a:visited{}. (8) Group selector p,h1{}.

9, Inheritance: Some styles will inherit the style of the parent class, such as Font-size,color. However, some styles do not inherit, such as border.

10. CSS style: font-family, font-size, Font-style, color, text-decoration, text-indent, letter-spacing, Line-height, Text-align.

11, Box model: composed of four parts, respectively, content, padding, border, margin. Length: Margin-left+border+padding-left+content+padding-right+border+margin-right. Padding is the padding in the box, and the boundary is the border part.

12, Element classification: (1) block-level style: blocks, width is the width of the parent class, you can set the style width, height, and so on, each block-level element occupies a row. (2) inline style: inline, the width is determined by the text content, you cannot set the height and width of the style, and multiple inline styles can be displayed on one line. (3) inline block style: Inline-block, its width is determined by the text content, multiple can be displayed on one line, and with inline style can set the height and width of the function.

13, Layout model: (1) Flow model: block-level elements of each row; Inline elements can be displayed in one row. (2) Floating model: Float:left/right. (3) Layer model: Absolute positioning reference is the parent class object; the relative positioning reference is itself; fixed locates the parent class, but the drop-down bar moves along with it. (4) Absolute and relative combination: Now the parent class is set position:relative, and then the child class element is set to Position:absolute, then the child class's positioning reference is the parent class object that was just set.

14, abbreviation: border:10px 20px 10px 20px for border:10px 20px;border:10px 20px 20px 20px for border:10px 20px 20px.

15, Length value: Px;em is the length of the reference parent class, and% is the length of the reference parent class.

16. Center setting: The middle of the text in the inline element: Text-align:center. Fixed width block element: margin:0 Auto (because there is a width, the block element does not have an exclusive full line, can be moved). Variable width block element: Because each block element width is the width of the parent class, the exclusive row cannot be moved freely. (1) Add in table, then set margin:0 Auto in table, (2) display:inline. Sets the block element to the inline element, which is set using Text-algin:center. (3) Set floa:left;position:relative;left:50% in the parent class first, and then set floa:left;margin:0;padding:0;position:relative;left:-50% in the subclass. margin:0 auto; cannot be used in inline and can be used in display:table.

17, Vertical Center: (1) Single line: parent element height:100px;line-height:100px; line spacing is similar to a line of stationery, including the font size and spacing between fonts. (2) Multiple lines: Put multiple lines of text or pictures in the label <table>, and then use the VERTICAL-ALIGN:MIDDLE;TD tab to set the default Vertical-align:middle. (3) Multiple lines: Set the <div> box model to Display:table-cell; Activate Vertical-align:middle.

18, Position:absolute; and float:left/right; the inline element is automatically set to Inline-block to set the width and height, and the element does not occupy an entire line.

HTM L+CSS Basic Knowledge points

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.