我想弄清楚如何将导航菜单栏中的标题链接到单击文本时的任何URL。当我将<a href>
标签放在它的周围时,标题就会出现在屏幕左侧并更改颜色,并收到下划线。我怎样才能保持标题的方式,但链接到一些网址?如何将导航菜单中的标题与网址链接?
<style>
body {margin:0;}
.Header {
z-index: 100;
position: fixed;
top: 0;
width: 100%;
background-color: #000000;
height: 70px;
}
@media screen and (max-width:680px) {
.Header.responsive {position: relative;}
.Header.responsive li.icon {
position: absolute;
right: 0;
top: 0;
}
}
@media (max-width: 960px){
.Header .headerLogo{
position: relative;
display: flex;
width: 86px;
height: 15px;
margin: 0 auto;
}
}
.headerLogo{
text-align: center;
font-size: small;
font-style: italic;
font-family: Verdana;
color: white;
}
</style>
<body>
<div class="Header" id="myHeader">
<a class = "headerLogo">
<h1>Lunation Boards</h1>
</a>
</div>
</body>
<body>
所以我更新了我的代码,但我得到在鼠标变成手的问题(点击标题)在整个导航菜单栏,而不是仅仅在标题。代码如下。
<div class="Header" id="myHeader">
<a class = "headerLogo">
<a href="file:///C:/Noah's%20stuff/LunationBoards/Home.html" ><h1 style="color:white; font-family: Verdana; font-style: italic; font-size: x-large;
text-align: center;">Lunation Boards</h1></a>
<style>
a{text-decoration: none}
</style>
你不能有一个''元素作为另一个''元素的后裔。 –