Introduction to CSS (Cascading Style Sheet) - Technology & Web designing

Breaking

Thursday, 7 May 2020

Introduction to CSS (Cascading Style Sheet)



Introduction :

CSS stands for Cascading Style Sheet. Style defines how to display html element/tags. CSS allows styling of Web page. CSS is an advance tool for web designer to create Professional Webpages that cannot be made using regular HTML attribute. CSS can be Internal, External and Inline.

Internal CSS :

Internal Style Sheet can be defined internally within the web document. To define CSS into html code <style> tag is used within <head> tag.

CSS Syntex

A style sheet is a set of rules. To define a rule user needs

  • A Selector
  • A Declaration - i.e. Property & Value

Let understand with this

This selector is normally the HTML element/tag you want to style. Each declaration consist of a property and a value. The property is the style attribute you want to change. Each property has a value.

A CSS declaration always ends with a semicolon (;) and declaration groups are surrounded by curly brackets. Property and Value can be separated by colon (:).

See the example

Programe

Output



External Style Sheet

An external Style Sheet is ideal when the style is applied to many pages. In this method style definition are stored in a separate file extension .css. Link the file with the HTML document using <Link> tag within <head> tag.

Consider the following example

The first style.css is external file stores style definition. The second file, external.html, is HTML document that uses the style stored definition stored in the file style.css

Style.css

h1{font-size:italic; color:black}

P{color:black}

In the preceding code, the style for <h1> and <p> tags are defined. Save the file with style.css.

The following is the code for the external.html file

Programe

Output



<Link> Tag and their attribute

<Link> tag is used to link style sheet properties to an HTML document. User can also define by linking to an External Style Sheet. <Link> tag is used within <head> tag.

Attributes of <link> tag :

  • REL : This attribute is used to define the relationship between the linked file and the attribute HTML document.
  • TYPE : This attribute is used to specify a media type=text/css for Cascading Style Sheet.
  • HREF : Specifies the CSS filename to be linked.
In the next Post we will see the Inline Style Sheet.

No comments:

Post a Comment

If you have any doubts regarding this please comment or email us.