← Back to blog

CSS

·1 min read

Frontend

This is an early study note from 2018. Some of it may be out of date.

Selectors

  • Selector syntax:

selector { property: value; property: value }

  • Selector: the process of choosing which tags to style

  • Types of selectors:

  • Tag selector
  • Class selector
  • ID selector
  • Universal selector
  • Intersection selector (tag-qualified)
  • Child selector
  • Union (grouping) selector
  • Additional selectors (CSS3):
  • Pseudo-class selectors
  • Attribute selectors
  • Pseudo-element selectors

Tag selector

  • Tag selector syntax:

HTML tag name { property: value; }

  • Common properties:
  • color —> foreground color (text color)
  • background-color —> background color
  • font-size —> font size
  • width —> set the width
  • height —> set the height