Basic knowledge points of html and css (1)

 

      Pseudo-class selector:

Pseudo-class is to add ":" directly after the element, such as a:hover, which can be used directly in css instead of being defined like a class in html, because it is preset by the browser.

a The general order is: a:link{} unvisited state link

a:visited{} visited status link

a:hover{} state when the mouse is hovered over

There are other pseudo-classes, such as first-child corresponding to the first child element, last-child last child element, nth-child (even/2n) even-numbered child element, nth-child (odd/2n+1) odd-numbered element child elements.

 

   Definition of box model:

 

CSS treats each element as a box and includes the following properties:

Content area content area: Contains content, the content can determine the size, or you can set the width and height by yourself. The width property of an element specifies the width of the content area, which can be specified in pixels or in percentages relative to the size of the container where the element is located, such as the body div.

Padding: The transparent area outside the content area can be regarded as part of the element. Setting the background to the element will extend to the padding.

border border: The border around the padding.

Margin: The transparent area outside the border, which provides the space between elements, and the element background does not extend to the margin. The left and right margins of elements (inline, such as images) are added, and the top and bottom margins (of block elements) are collapsed, whichever is the largest, and the same is true for nesting. Also, the margins of floated elements do not collapse as they would in normal flow.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324647031&siteId=291194637