gpt4 book ai didi

javascript - 如何更改文本链接在鼠标悬停时显得更大

转载 作者:太空宇宙 更新时间:2023-11-04 11:51:06 25 4
gpt4 key购买 nike

这里我想让链接文本在鼠标悬停在它上面时显得更大,因为我已经应用了属性 x.style.fontsize = "40px";但无法这样做。我想弄清楚这有什么问题,我该怎么做????????

<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>

最佳答案

你不需要 JS。您可以使用 CSS:

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

用JS编辑非单字CSS规则时,需要使用camelCase :

x.style.fontSize = "40px";

注意大写S

关于javascript - 如何更改文本链接在鼠标悬停时显得更大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30624864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com