Introduction to CSS

CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML.

What CSS Does ?
  • Controls the look and feel of web pages: CSS is responsible for how elements on a web page are displayed. This includes:
    • Colors: Text color, background color, border colors.
    • Fonts: Font size, family, weight, style.
    • Layout: Positioning elements, spacing, and overall page structure.
    • Dimensions: Width, height, padding, margins.
    • Visual effects: Borders, shadows, animations.
  • Separation of concerns: CSS allows you to separate the content (HTML) from the presentation (CSS). This makes your code more organized, easier to maintain, and reusable.
  • Cross-browser compatibility: CSS helps ensure that your web pages look consistent across different browsers and devices.
  • Example:
p { 
color: blue;
font-size: 16px;
}
Ways to include CSS
  • Inline CSS: Adding style attributes directly to HTML elements (e.g., <p style=”color: red;”>).
  • Internal CSS: Placing CSS rules within an HTML document’s <head> section using the <style> tag.
  • External CSS: Creating a separate CSS file and linking it to the HTML document using the <link> tag.
Scroll to Top