In previous lesson, we have learned how to create inline style for a section of an HTML document using the Style attribute of the CSS. In this lesson, we shall learn how to create style for an HTML document using the embedded style sheet.
Embedded Style Sheet means we embed an entire style sheet into an HTML document’s head section.
The style sheet section always starts by defining the style’s types, or rather MIME type. For text document, we always start with
New Page 1
Embedded Style Sheet means we embed an entire style sheet into an HTML document’s head section.
The style sheet section always starts by defining the style’s types, or rather MIME type. For text document, we always start with
The body of the style sheet goes within and
The body of the style sheet declares rules for the HTML elements. For example,
p {font-size:16pt} declares that the font size of the p element in
the entire HTML document. This means that when we use the p element in
our HTML document , the font size of the text enclosed within the
tag will be 16.
You can add other attributes(or properties) to the p element, such as
p {color:green; line-height:14px; text-decoration: underline;}
This means that within the tags, the text color is green, line spacing is 14 pixel and text is underlined.
Here is a sample embedded style sheet:
body{background-color:yellow}
h1{font-size:20;color:blue}
p {font-size:14pt; color:red}
Embedded Style Sheet Example 1
The entire HTML document can be formatted
using embedded Cascading Style Sheet, it makes formatting a web page
much easier
The Output
Embedded Style Sheet Example 1
The entire HTML document can be formatted using embedded Cascading Style Sheet, it makes formatting a web page much easier
0 Comments
Good day precious one, We love you more than anything.