Kushagra Singh Rajput
Kushagra Singh Rajput

Reputation: 299

how to change text link appear bigger when mouse over it

Here i want to make link text appear bigger when mouse over it for that i have applied the property x.style.fontsize = "40px"; but unable to do so.I want to figure out what is wrong in this and how can I do that ?????????

<script>
function big(x){
x.style.color = "red";
x.style.fontsize = "40px";
}
function small(x){
x.style.color = "white";
x.style.fontsize =20px;}

</script>
<meta http-equiv="content-Type" content="text/html; charset=utf-8" />
<link rel= "stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
</head>
<body>
<img src="tree.jpg" width="1340px"style="position:absolute;top:0px;height:655px"> 
<img src="logo.gif" height="200" width="180px"style="position:absolute;top:265px;left:600px">
<div="logo1" style="position:fixed">
<div id="logo" style="width:1340px;height:125px;background-color:BLACK;opacity:0.7"></div>
<img src="logo3.gif" alt ="vstudy" "height="150px" width="130px" style="position:absolute;left:0px;top:8px">
<p>
 <span class ="home" style ="position:absolute;left:150px;top:50px;font-weight:bolder;color:white;font-size:18px">Where things go cyberneted...</span>
<span><a href="#" style="text-decoration:none;position:absolute;right:568px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">HOME</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:440px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">OUR MISSION</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:240px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">PRODUCTS & SERVICES</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:140px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">ABOUT US</a></span>
<span><a href="#" style="text-decoration:none;position:absolute;right:20px;top:50px;font-weight:bold;color:white;font-size:15px" onmouseover="big(this)" onmouseout="small(this)">CONTACT US</a></span>
</p>
</div>
</html>

Upvotes: 1

Views: 4437

Answers (2)

Okku
Okku

Reputation: 7819

You don't need JS for this. You can use CSS:

a{
  font-size:20px;
}
a:hover{
  font-size:40px;
}

When editing non-single word CSS rules with JS, you need to use camelCase:

x.style.fontSize = "40px";

Notice the capital S

Upvotes: 3

Jon Koivula
Jon Koivula

Reputation: 947

Try this:

x.style.fontSize = "20px";

have s letter in uppercase - fontSize

also script tag as

<script type="text/javascript">

Upvotes: 0

Related Questions