CSS (Cascading Style Sheets) is used to style and layout web pages. It is a stylesheet language that describes the presentation of an HTML document. CSS is a powerful tool for web design, allowing you to create visually appealing and responsive web pages.
This is the basic syntax of CSS:
selector {
property: value;
}body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}In this example:
bodyandh1are selectors.background-color,color, andmargin-leftare properties.lightblue,navy, and20pxare values.
Selectors are used to target the HTML elements you want to style. Common selectors include:
element(e.g.,p,h1).class(e.g.,.container)#id(e.g.,#header)
Properties are the aspects of the element you want to change, and values are the settings you apply to those properties.
You can add comments in CSS using /* comment */.
/* This is a comment */
p {
color: green;
}Intro Stage-4 --- Go Back --- Next