Types of CSS

0

- Advertisement -

Inline Style CSS

Inline Style can be assigned to the style attribute of any html tags.

“tag style = “attribute: value”” specifies the attribute and its value for some tags’s contents.

Example

Output:

Text Sample

Explanation:

“color:blue;font-family:Calibre;font-size:30pt” specifies the text color as blue, font family Calibre, and font size as 30pt.

Note: Inline Style is not recommended to use because it affects the whole CC layout.

Internal Style CSS

Internal Style  CSS is a standard CSS which is most frequently used in HTML and CSS file: The syntax looks like this:

Example

Output:

Hello World

Hello Delhi

Explanation:

<style type = “text/css”>….</style> is an internal style CSS syntax, decalring an internal css.

“h2{ color : orange } “ specifies the font color for tag

“<h2>Hello World</h2>”.

“p{font-size: 18pt}” specifies the font size for tag

“<p>Hello Delhi</p>”.

CSS uses /* and */ as comment.

/*declares an external style css */ is a css comment.

External CSS

With external CSS, you’ll link your web pages to an external .css file.This CSS type is a more efficient method, especially for styling a large website. By editing one .css file, you can change your entire site at once.

HTML link with external style sheet by linking

in <head>…………………………….</head> is done.

Example

style.css file

index.html file

Output

- Advertisement -

Leave A Reply

Your email address will not be published.