Css I: Definition, Basics and Structure

css Basics and Structure

What is CSS. Stylesheet (style.css). Facts and Definition of CSS:

  • Cascading Style Sheets
  • These styles define: display of HTML elements (How HTML elements are to be displayed)
  • External Style Sheets are stored in CSS files

A CSS file allows you to separate your web sites (X)HTML content from it’s style. You can combine selectors. Elements of CSS (Basics and structure):

  • Selector (one HTML element)
  • Property (attribute of a style you want to define or change)
  • Value (numeric or describe)
  • Example:
    p
    {
    color:blue;
    text-align:right;
    }
  • Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers. /*Comments*/

At the moment we are using latest version of CSS and this is CSS 3. CSS allows you to specify your own selectors called “id” and “class“. Ways of inserting a style sheet

  • External style sheet
  • Internal style sheet
  • Inline style