With an example explain different levels of style sheets.

With an example explain different levels of style sheets.


Answer:

There are three types of CSS
External CSS
Internal CSS
Inline CSS

  • External CSS it contains an external stylesheet for CSS it is easy to handle and we can control the whole website from one CSS page.
Example
CSS file name: getways.css
body
{
 background-color:grey;
}
#id{
font-style:bold;
}
.class{
font-style:italic;
}

HTML file name getway.html
<html>
<head>
<link rel="stylesheet" href="getways.css"/>
</head>
<body>
<div class="class">
<h3>Hi welcome</h3>
<p> GetWays Solution>
</div>
<div id="id"/>
<p>It is amazing</p>
</div>
</body>
</html>

  • Internal CSS it is placed on the top of each web page it is easy to find but we have to write separate CSS for each page.we will place CSS style inside <style> tag which will be inside head tag.

Example:

HTML file name getway.html
<html>
<head>
<style>
body
{
 background-color:grey;
}
#id{
font-style:bold;
}
.class{
font-style:italic;
}
</style>
</head>
<body>
<div class="class">
<h3>Hi welcome</h3>
<p> GetWays Solution>
</div>
<div id="id"/>
<p>It is amazing</p>
</div>
</body>
</html>


  • Inline CSS we can place it inside an HTML element where we need it.

HTML file name getway.html
<html>
<head>
</head>
<body style="background-color:grey;">
<div style="font-style:bold;">
<h3>Hi welcome</h3>
<p> GetWays Solution>
</div>
<div style="font-style:italic;"/>
<p>It is amazing</p>
</div>
</body>
</html>

Other Question With Answer


















No comments:

For Query and doubts!

Powered by Blogger.