CSS (Cascading Style Sheets)

A style sheet language used for describing the presentation of a document written in HTML or XML. Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML, etc.). It controls the layout, colors, fonts, and other visual aspects of a web page.

Basic Syntax:

selector {
  property: value;
}

Selectors:

Box Model:

Example:

/* Styles for a simple box */
.box {
  width: 200px;
  height: 200px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  padding: 20px;
  margin: 20px;
  text-align: center;
}

/* Styles for a class */
.button {
  display: inline-block;
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 5px;
}

/* Styles for an ID */
#header {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  color: #333;
}