What is CSS?
CSS stands for Cascading Style Sheet.
What CSS does?
CSS allows you to create rule’s that specify how the content of an element should appear.For example, you can specify that the background of the page is white, all paragraphs should appear in gray using the Arial typeface, or that all level one headings should be in a blue, italic, Times typeface.
We can use CSS in three way to our html page.
Inline CSS style: In this type of CSS style we have to embed style within the HTML element.
Example:
<h1 style="color:blue">Blue Heading</h1>
Internal CSS Style: In this type of CSS style we have to write CSS styles in the head section of the html page.
Example:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>CSS Style</title>
<style type="text/css">
h1{
Color:Blue;
}
</style>
</head>
<body>
<h1>Blue Heading</h1>
</body>
</html>
Output:
External Style Sheet: In this type of CSS we have to create a external page for style and save it with .css extension then embet it to the html page in the head section.
Example:
/*Cascading Style Sheets*/
h1{
color:red;
}
style.css the name of the external style sheet and we have to link this page to html page where we want to apply this style.
Example:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>External Style</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Blue Heading</h1>
</body>
</html>
Output:
No comments:
Post a Comment