CSS (Notes)
1. Introduction to CSS:
• CSS (Cascading Style Sheets) is a stylesheet language used to describe the
presentation of a document written in HTML or XML.
• CSS allows you to control the layout, colors, fonts, and positioning of elements on the
page.
2. CSS Syntax:
• A CSS rule consists of a selector and a declaration block.
• The declaration block contains properties and values.
h1 {
color: red;
font-size: 24px;
3. Box Model:
• The Box Model is a fundamental concept that defines how elements are structured in
CSS.
o Content: Actual content like text or images.
o Padding: Space around the content.
o Border: The border that surrounds padding.
o Margin: Space outside the border, creating distance between elements.
4. CSS Selectors:
• Universal Selector: * (Targets all elements).
• Class Selector: .className (Targets elements with the specified class).
• ID Selector: #idName (Targets the element with the specified ID).
5. CSS Layout Systems:
• Flexbox: A one-dimensional layout system used to align items in a row or column.
o Align items along the main axis and cross axis.
• CSS Grid: A two-dimensional layout system with rows and columns for more complex
layouts.
6. Responsive Design:
• Media Queries: Allow different styles to be applied based on the device's screen size.
@media screen and (max-width: 600px) {
body {
background-color: lightblue;