In: Computer Science
Use a style sheet to define the following rules and implement
the given HTML code. Please
put your style information within the same file as the HTML
code.
Rules
• Hyperlinks using the nodec class should display no decoration. •
Hyperlinks should
display text in white with a green background color when the mouse
pointer is held over
the link. (use the hover pseudo-class)
• Unordered lists not nested within any other lists should be
displayed in blue text and
should be in bold.
• Ordered lists that are nested within one Unordered lists should
be displayed in red
text.
• Unordered lists that are nested within one Unordered lists should
be displayed in green
text and should be underlined.
• Replace “insert a web address of your choice” with a web address
of your choice and
replace “Put title here” with a title that matches the URL.
HTML Body Code
<BODY>
<H2>
<a class="nodec" href="http://insert a web address of your
choice.com">Put title here</a>
</H2>
<UL>
<LI>Macintosh OS</LI>
<LI>Microsoft</LI>
<OL>
<LI>Windows 98</LI>
<LI>Windows 2000</LI>
</OL>
<LI>Linux</LI>
<UL>
<LI>Redhat</LI>
<LI>Slackware</LI>
</UL>
<LI>OS/2</LI>
</UL>
</BODY>
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new web page with name "url.html" is created, which contains following code.
url.html :
<!DOCTYPE html>
<html lang="en">
<head>
<!-- title for web page -->
<title>Style sheet</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <style> is used for embedded stylesheet -->
<style>
/* style rule for hyperlink with class=nodec */
a.nodec {
text-decoration: none;
}
/* style rule for hyperlink when mouse pointer held over the hyperlink */
a.nodec:hover {
color: white;
background-color: green;
}
/* style rule for ul */
ul {
color: blue;
font-weight: bold;
}
/* style rule for ol in ul */
ul ol {
color: green;
font-weight: normal;
text-decoration: underline;
}
/* style rule for ul in ul */
ul ul {
color: green;
font-weight: normal;
text-decoration: underline;
}
</style>
</head>
<body>
<BODY>
<H2>
<a class="nodec" href="http://Amazok.com">Amazok.com</a>
</H2>
<UL>
<LI>Macintosh OS</LI>
<LI>Microsoft</LI>
<OL>
<LI>Windows 98</LI>
<LI>Windows 2000</LI>
</OL>
<LI>Linux</LI>
<UL>
<LI>Redhat</LI>
<LI>Slackware</LI>
</UL>
<LI>OS/2</LI>
</UL>
</BODY>
</body>
</html>
======================================================
Output : Open web page url.html in the browser and will get the screen as shown below
Screen 1 :url.html
Screen 2:Screen when mouse is hover the hyperlink
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.