Define CSS and explain the types of stylesheets. (Grade 11)

Define CSS and explain the types of stylesheets. (Grade 11)

CSS (Cascading Style Sheet)

CSS is a designing language which provides additional functions for the HTML tag. It is used with HTML tags inside or outside the tag body. It provides different formatting and designing options for different components or whole webpage. There are 3 methods of writing CSS codes. They are:

  1. Inline Style Sheet
  2. Internal Style Sheet
  3. External Style Sheet

Inline Style Sheet

The CSS codes which is written inside the tag body is called inline style sheet. It is used for particular HTML tags in the HTML page.

Example:

<p style=”text-color:blue;margin-left:20px”>….</p>

Internal Style Sheet

It is the CSS code written inside <head> tag using <style> tag. It is defined for specific HTML tag to use anywhere in the webpage. It doesn’t need to write or call in the HTML tag.

Example:

<html>

<head>

<title>MeroPaper</title>

<style>

p

{

text-side:14pt;

text-color:blue;

margin-left:20px;

}

</style>

</head>

<body>

<p>MeroPaper is an educational portal.</p>

</body>

</html>

External Style Sheet

It is the CSS code written in a text file with extension .css. It can be used in any webpage of the website. It can contain the definition of many tags. It is linked with HTML page to use its functions.

Example:

style.css

h1{

text-side:25pt;

font-family:arial;

align:center;

}

main.html

<html>

<head>

<title>…</title>

<link rel=”stylesheet” type=”text/css” href=”style.css”>

</head>

<body>

<h1>MeroPaper</h1>

</body>

</html>

This question isn’t important for examination but it can help the students know the basics of web designing.