1. Hyperlink pseudo-classes (love hate)

Note:Hyperlink pseudo-classesIs betweenHaving a definite order of writingOtherwise, sometimesSome styles don’t execute.

1. Link Bogus classes of unaccessed hyperlinks

A: Link {CSS style code}Copy the code

2. Visited The pseudo-classes of hyperlinks that have been visited

A: Visited {CSS style code}Copy the code

3 hover mouse trigger pseudo class

A :hover{CSS style code}Copy the code

4. Active The pseudo class is triggered when the mouse is pressed down and disappears when the mouse is released

A :active{CSS style code}Copy the code

What pseudo-classes do: They are part of the triggering style added to an element

2. [img] Background image properties

Background-color Indicates the color of the background

Function: Specifies the background color of an element.

(Refer to chromatography for specific color)

Opacity/opacity

Action: Specifies the opacity/transparency of an element. The value ranges from 0.0 to 1.0. The lower the value, the more transparent.

Note: UseopacityProperties forBackground of elementsaddtransparencyWhen its allChild elementsallInherit the same transparency. This may beAn element that makes it completely transparentWithin theText is difficult to read.

You can use RGBA’s transparency notation:

The RGBA color value is specified as RGBA (red, green, blue, alpha). The alpha parameter is a number between 0.0 (completely transparent) and 1.0 (completely opaque).

Background-image A background image

Role: Image used as element background.

By default, the image is repeated to cover the entire element.

    background-image: url(a);Copy the code

Url () : the path address of the image

【background-size】 Sets the image size

Parameter values:

parameter1: x direction parameter2: y directionCopy the code

The units can be relative (100%) or absolute (CM PC)

Value of the second parameter:

autoThe image image is expanded to the maximum size so that its width and height fully fit the content area. Cover To extend the background image to a large enough size that the background image completely covers the background area. Some parts of the background image may not be displayed in the background location area. (Don't worry about the complete image, just fill the area.)Copy the code

【background-repeat】 Set the image tiling

What it does: Repeats the image both horizontally and vertically.

1. Tiling only in horizontal direction

    background-repeat: repeat-x;
Copy the code

2. Tiling only in the vertical direction

    background-repeat: repeat-y;
Copy the code

3. No tiling, no repetition, only display the background image once

    background-repeat: no-repeat;
Copy the code

[Background-position] Sets the position of the background image

Action: Specifies the position of the background image.

Parameter values:

top】 【right】 【left】 【bottom] [center]Copy the code

Sprite picture. Sprite picture

What it does: Putting multiple small ICONS into one image reduces the number of requests to the server.

Usage:

1. background-image: Insert a Sprite diagram composed of multiple images2Background-size: Sets the background size of the image3Background-position: Adjusts the position of the background image by percentageCopy the code

[Background-attachment] Set page fixed background picture

Action: Specifies whether the background image should scroll or be fixed

(Does not scroll with the rest of the page).

Parameter values:

【fixed】 scroll 【local】 scroll 【fixed】 scroll 【local】inheritInheriting the parent element attribute unset is not definedCopy the code

Background-origin specifies the location area of the image

Parameter values:

padding-box: Relative position of the background image filling box [border-box: Relative position of the boundary box of the background imagecontent-box Indicates the relative position of the background image in the content boxCopy the code

【 BACKground-clip 】 Sets image clipping

Parameter values:

border-box Indicates the default value. The background is drawn inside the border box (cut into the border box). 【padding-box】 The background is drawn in a spacing box (cut to a spacing box). 【content-box】 The background is drawn inside the content box (cut to the content box).Copy the code

Background Short for background property

background: (color) (image) no-repeat (attachment)(position)
Copy the code

attachment: Not necessary