Reputation: 77
This is my CSS style sheet:
a:link {color:green;}
a:visited {color:yellow;}
a:hover {color:black;}
a:active {color:blue;}
div.ex
{
font-family:Impact;
letter-spacing:1px;
font-size:60px;
position:relative;left:200px;top:15px;
color:#DEDEDE;
text-shadow: -1px 0 red, 0 1px red, 0 1px red, 0 -1px red;
}
body
{
background:url("hello.gif");
background-size:100% 12%;
background-repeat:no-repeat;
}
.h
{
font-family:"Comic Sans MS";
letter-spacing:2px;
font-size:40px;
position:fixed;left:570px;top:12px;
color:#E6001A;
text-shadow: -2px 0 black, 0 2px black, 0 2px black, 0 -2px black;
}
.border
{
border-style:ridge;
border-color:white;
}
This is my html code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="ex2.css">
</head>
<body>
</head>
<div class="ex"><b>Zrack</b></div>
<hr class="border">
<a href="file:///C:/Users/admin/Desktop/Site/main.html">HOME</a>
</body>
</html>
I am linking it to something on my own computer. It does visit the page but the color remains default.Please point out what I am doing wrong. I have been trying to figure this out for 2 hours.
Upvotes: 0
Views: 2839
Reputation: 5246
The problem is with your href
and not with the CSS.
Change...
<a href="file:///C:/Users/admin/Desktop/Site/main.html">HOME</a>
to
<a href="main.html">HOME</a>
and it will work. (You should be using a webserver and linking to files like the above and not as a file link.)
Also, there is an error in your HTML. You have two closing head
tags and one of them is closing after the body
tag is opened...
</head>
<body>
</head>
All the best.
Upvotes: 1