CSS interview questions (continuously updated...)

1.The difference between em and rem

  • em is a relative length unit, relative to the font size of the text within the current object. If the font size for inline text is not currently set, it will be relative to the browser's default font size. It is not a fixed value and will inherit the font size of the parent element.
  • rem is a new relative unit in CSS3. When using rem to set the font size, it is only set relative to the html root element.

2.What are the new features of CSS3?

  • border-radius - rounded corners
  • box-shadow - shadow
  • text-shadow - text shadow
  • gradient - linear gradient
  • transform - rotate, scale, move or tilt
  • scale - scale
  • translate —— displacement
  • Media inquiries
  • multi-column layout
  • multiple backgrounds

3.What are the new pseudo-classes in CSS3?

  • :first-of-type – selects the first element that belongs to its parent element
  • :last-of-type – selects the last element that belongs to its parent element
  • :only-of-type – selects the only element that belongs to its parent element
  • :only-child - selects the only child element that belongs to its parent element
  • :nth-child(n) - selects the nth child element belonging to its parent element

4.What is flexible layout?

Solve the layout of sub-elements in a certain element and provide maximum flexibility for layout.
After setting to flex layout, the float, clear and vertical-align attributes of child elements will be invalid.
display:flex attribute
align-self defines the position of child elements

Guess you like

Origin blog.csdn.net/qq_36842789/article/details/129382807