CSS knowledge point 2

pseudo-type

   in all browsers, The style of the hyperlink is different in different periods of mouse click.

  (1) Default: the font is blue with underline.

  (2) When the mouse is clicked: the font is red with underline.

  (3) After clicking the mouse: the font is purple with underline.

   We can use text-decoration: none; to remove the underline of the hyperlink.

  default hyperlink style

  De-underline hyperlink style

The style of the link can use any CSS attributes (such as color, font, background, etc.).

Special links can have different styles, depending on their status.

The four link statuses are:

  • a:link-normal, unvisited link
  • a:visited-user has visited Link
  • a:hover-when the user mouses over the link
  • a:active-the moment the link is clicked

    When set to several link state styles , There are also some order rules:

  • a:hover must follow a:link and a:visited

    , a:active must follow a:hover

< p>

Hidden elements

   can be divided into two hiding methods: Display and Visibility (visible )

The display attribute sets how an element should be displayed, and the visibility attribute specifies whether an element should be visible or hidden. An element can be hidden by setting the display property to “none” or the visibility property to “hidden”. Note, however, that these two methods will produce different results. visibility: hidden can hide an element, but the hidden element still needs to occupy the same space as before. In other words, although the element is hidden, it still affects the layout.

  

  Picture 1 display: none hide (not occupy position)

share picture There is no space between the two lines

  图二 visibility :Hidden hide (occupy position)

share pictureThere is space between the two lines

The picture shows the gap between the two

Display-blocks and inline elements

  Three label modes: display

    Block label (block): One line by default The default width and height 0 to set the width and height

     inline-block does not occupy a line width and height can be set

     inline-block does not occupy a line width and height cannot be set According to the content, it is the same as span

Level: z-index The higher the number, the higher the upper (front) level

Leave a Comment

Your email address will not be published.