CSS_Notes
CSS_Notes
Introduction to CSS
CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in
HTML or XML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript. CSS allows
CSS uses a selector-based syntax to apply styles to elements. Selectors define the HTML elements you want to style.
Types include universal selectors (*), class selectors (.classname), ID selectors (#id), and attribute selectors.
The box model is fundamental in CSS. It describes the rectangular boxes generated for elements in the document tree
CSS Units
CSS supports various units for defining dimensions: Absolute units include px (pixels), cm (centimeters), etc., while
CSS provides properties for styling text, such as font-family, font-size, font-weight, color, line-height, text-align, and
CSS allows you to define colors using Hex, RGB, or HSL formats. Backgrounds can be styled with solid colors,
gradients, or patterns.
Positioning in CSS determines how elements are placed in the document. Properties include static, relative, absolute,
fixed, and sticky. Layout techniques include float, flexbox, and grid.
CSS Flexbox
Flexbox is a layout model for arranging elements in a container. It allows elements to align and distribute space
CSS Grid
CSS Grid Layout is a two-dimensional layout system for web pages. It lets you define rows, columns, and areas to
Responsive Design
Responsive design ensures your website looks good on all devices. Techniques include using media queries, a
CSS transitions provide smooth changes between property values, while animations allow for more complex sequences
using keyframes.
CSS Notes
Pseudo-classes (e.g., :hover, :nth-child) define a special state of an element. Pseudo-elements (e.g., ::before, ::after)
CSS Variables
CSS variables, also known as custom properties, enable reusability of values throughout your CSS. They are defined
CSS Frameworks
Popular CSS frameworks like Bootstrap and Tailwind simplify web development by providing predefined styles and
components.
Maintain clean and modular CSS by using consistent naming conventions, minimizing specificity, and avoiding inline
styles. Optimize for performance by minimizing file size and reducing render-blocking styles.