Mind Diary

CSS Basics

CSS :

CSS lets you control all the elements of your document's appearance – fonts, text, colours, backgrounds, sizes, borders, spacing, positioning, visual effects, tables, and lists.

The Basic CSS Selectors :

CSS works by defining the styles of the elements on a Web page using CSS rules.

Rules are applied using selectors, which come in three basic varieties:

  • HTML selectors are used to reference a specific tag;
  • Class selectors, which are applied individually to elements;
  • ID selector that is applied to a single element on the page.

Adding Styles to a Web Site –
Creating an External Style Sheet:

You can create a style sheet once and use it either in a single web page or throughout your entire website.

To do this, you create an external CSS file that contains only CSS code and that is separate from the HTML document.

Establishing an external CSS file is a two–step process:

  1. You set up the CSS rules in a text file.
  2. You link or import this file into an HTML document using the <link> tag or the @import rule.