12. CSS Types by JS Rao Sir
12. CSS Types by JS Rao Sir
2. Internal Styles:
Internal styles are applied by using a <style> element inside the <head> tag section.
It is used to apply the styles for the whole webpage that meens any where inside the same web-page.
By using Internal CSS styles, we can apply the same styles for multiple HTMl tags with in the current
html file.
Syntax:
<html>
<head>
<style>
tag_name {
css_property1 : value1 ;
css_property2 : value2 ;
........ .......
}
</style>
</head>
<body>
=====
=====
</body>
</html>
<html>
<head>
<title>Internal CSS</title>
<style>
h1{
color: darkblue;
font-family: cursive;
font-size: 100px;
text-align: center;
background-color: orchid;
border-radius: 100px;
}
body{
background-color:blue;
}
</style>
</head>
<body>
<h1>Welcome to Facebook</h1>
</body>
</html>
3. External Styles:
External styles are applied by using an external CSS file (.css file)
All external css styles , we are writing inside one separate file and save the file name as with .css
extension.
For example: demo.css
Finally, we have to provode the link between .css file and .html files by using <link> tag inside
<head> tag.
For example: <link rel="stylesheet" href="demo.css">
We can apply these styles for all html tags which are available in current html file.
We can use external css styles in multiple web pages for getting reusability styles purpose.
Advantages :
Reusability of code for multiple pages.
Length of the html programs are reduced
Burden on the developer is reduced while updating the web-page.
<body>
<h1>Welcome to Facebook</h1>
</body>
</html>
home.css
h1{
color: red;
text-align: center;
font-size: 100px;
font-family: cursive;
}
body{
background-color: green;
}