Hyperlink 冲突的a href链接?
因此,我试图创建一个包含两个不同链接的网站——然而,我编辑它们时使用的CSS将它们识别为“a”,并将它们放在同一位置。这是令人不快的,我试着把css建立在它们所在的位置,但这似乎不起作用。这是我的密码:Hyperlink 冲突的a href链接?,hyperlink,href,Hyperlink,Href,因此,我试图创建一个包含两个不同链接的网站——然而,我编辑它们时使用的CSS将它们识别为“a”,并将它们放在同一位置。这是令人不快的,我试着把css建立在它们所在的位置,但这似乎不起作用。这是我的密码: <html> <h1> <div id = "firstbutton"> <a href="http://google.com">GOOGLE</a> <style type="text/css">
<html>
<h1>
<div id = "firstbutton">
<a href="http://google.com">GOOGLE</a>
<style type="text/css">
a {
color: rgb(255,255,255);
font-size: 60;
font-family: Arial;
text-decoration: none;
position: fixed;
top: 50%;
left: 50%;
margin-top: -85px;
margin-left: -145px;
}
</style>
</div>
<div id = "forumbutton">
<a href="http://www.google.com">Forum</a>
<style type="text/css">
a{
color: rgb(255,255,255);
font-size: 30;
font-family: Calibri;
position: fixed;
text-decoration: none;
top: 50%;
left: 50%;
margin-top: 260px;
margin-left: -45px;
}
</style>
</div>
</h1>
<body>
<audio src="goingdown.mp3" autoplay></audio>
<style type="text/css">
body {
background-image: url('spacewallpaper.jpg');
}
</style>
</body>
</html>
a{
颜色:rgb(255255);
字号:60 ;;
字体系列:Arial;
文字装饰:无;
位置:固定;
最高:50%;
左:50%;
利润上限:-85px;
左边距:-145px;
}
a{
颜色:rgb(255255);
字号:30 ;;
字体系列:Calibri;
位置:固定;
文字装饰:无;
最高:50%;
左:50%;
利润上限:260px;
左边距:-45px;
}
身体{
背景图片:url('spacewallper.jpg');
}
这就是类派上用场的地方。您应该为每个a
添加一个class属性,并使用该类定义CSS。或者你可以用身份证
样式可以被多个样式块或声明覆盖。它不应用最近的标记。为每个元素设置ID
那么css应该是这样的:
a#name1{ ... }
a#name2{ ... }
这是你的固定密码
.GClass a{
颜色:rgb(255255);
字号:60 ;;
字体系列:Arial;
文字装饰:无;
位置:固定;
最高:50%;
左:50%;
利润上限:-85px;
左边距:-145px;
}
.F a类{
颜色:rgb(255255);
字号:30 ;;
字体系列:Calibri;
位置:固定;
文字装饰:无;
最高:50%;
左:50%;
利润上限:260px;
左边距:-45px;
}
身体{
背景图片:url('spacewallper.jpg');
}
您应该为尝试添加(实现)的每个元素设置和ID,然后您可以在CSS中轻松调用该元素
此外,元素div
不能嵌套在元素h1
中
字体大小应以像素为单位标记。示例
字体大小:30px代码> 您的文档结构有些分散
最好把你所有的风格都放在头部,而不是分散在身体部分
<html>
<head>
<style type="text/css">
body
{
background-image: url('spacewallpaper.jpg');
}
a
{
color: #FFFFFF;
text-decoration: none;
top: 50%;
left: 50%;
}
.FirstLink
{
font-size: 60;
font-family: Arial;
position: fixed;
margin-top: -85px;
margin-left: -145px;
}
.SecondLink
{
font-size: 30;
font-family: Calibri;
position: fixed;
margin-top: 260px;
margin-left: -45px;
}
</style>
</head>
<body>
<h1>
<div id = "firstbutton">
<a class="FirstLink" href="http://google.com">GOOGLE</a>
</div>
<div id = "forumbutton">
<a class="SecondLink" href="http://www.google.com">Forum</a>
</div>
</h1>
<audio src="goingdown.mp3" autoplay></audio>
</body>
</html>
身体
{
背景图片:url('spacewallper.jpg');
}
A.
{
颜色:#FFFFFF;
文字装饰:无;
最高:50%;
左:50%;
}
.第一链接
{
字号:60 ;;
字体系列:Arial;
位置:固定;
利润上限:-85px;
左边距:-145px;
}
.SecondLink
{
字号:30 ;;
字体系列:Calibri;
位置:固定;
利润上限:260px;
左边距:-45px;
}
尝试上面的代码,并将其与您自己的代码进行比较,以查看差异。祝你好运。你的“级联”定义部分正确,但更准确地说,
<html>
<head>
<style type="text/css">
body
{
background-image: url('spacewallpaper.jpg');
}
a
{
color: #FFFFFF;
text-decoration: none;
top: 50%;
left: 50%;
}
.FirstLink
{
font-size: 60;
font-family: Arial;
position: fixed;
margin-top: -85px;
margin-left: -145px;
}
.SecondLink
{
font-size: 30;
font-family: Calibri;
position: fixed;
margin-top: 260px;
margin-left: -45px;
}
</style>
</head>
<body>
<h1>
<div id = "firstbutton">
<a class="FirstLink" href="http://google.com">GOOGLE</a>
</div>
<div id = "forumbutton">
<a class="SecondLink" href="http://www.google.com">Forum</a>
</div>
</h1>
<audio src="goingdown.mp3" autoplay></audio>
</body>
</html>