CSS Introduction

CSS stands for Cascading style sheet is a technology to render style to your web page. It can change color, font, background, alignment and many other properties of an HTML page. The HTML only display the content for human readers.The HTML elements contain the following contents.

  1. Text
  2. Image
  3. Video
  4. Audio
  5. Links

The HTML is not enough to create a beautiful web-page because there is not much there to style the web document. You could change background color, or align the text : left, center or right and a few other style information.This was when people used HTML 4.0 standard. By the time HTML 5 become popular all style information was transferred to CSS.

Advertisements

The CSS contains a set of rules to specify the style of HTML elements. You can change many properties of an HTML element like text, color, background, etc. Some of the properties are given below.

  1. Background
  2. Typography
  3. Color
  4. Border
  5. Size
  6. Page layout

and many more.

CSS Introduction – What are CSS rules?

The CSS rule is very simple to remember. A CSS rule has two parts

  • Selectors
  • Declarations

The CSS selector is an HTML element whose style information we are going to change. The CSS selector is enclosed within curly braces. Remember that there are many types of CSS Selectors depending on how complex your web site is. A single rule applies to more than one selector if you wish. The CSS declaration is made of a property and a value pair and ends with a semi-colon.

Advertisements

For example

h2 {
color: red;
}

In the above example, the element h2 is a selector – an HTML element whose text color is changed to red. The color: red; pair is called the declaration where color is a property and value is red. Note than the declaration ends with a semi-colon.

How to apply CSS rules?

There are three ways to apply CSS rules and you can apply them depending on the complexity of HTML page or website.

  • Inline – CSS rules apply within HTML element and has highest priority.
  • Internal – CSS rules limited to an HTML page.
  • External – CSS file is linked to HTML document or website.
Advertisements

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Exit mobile version