【发布时间】:2019-11-27 11:21:56
【问题描述】:
我的标题徽标下方水平排列了六个链接,下方有一个图像。我使用 relative 属性定位这些链接,并希望它们用作菜单栏,并希望它们应用于我的所有页面以实现理想的导航。所以我只是简单地将链接复制并粘贴到我的其他页面的 HTML 代码中。
嗯,在我的其他页面上,我不一定想要在我的链接下方直接显示图像,但是当我删除它时,我的链接位置会发生巨大变化。这是我的网站和我的问题的 GIF:
这是我的“关于”页面的正文:
#about {
position: relative;
bottom: 315px;
left: -112px;
}
#news {
position: relative;
bottom: 315px;
left: -67px;
}
#store {
position: relative;
bottom: 315px;
left: -22px
}
#music {
position: relative;
bottom: 315px;
right: -22px
}
#connect {
position: relative;
bottom: 315px;
right: -67px
}
#submit {
position: relative;
bottom: 315px;
right: -112px
}
<body>
<hr id="line1">
<div class="wrapper">
<a href="gbwebsite.html"><img id="gblogo" src="images/GB.png" alt="good boy logo" width="128" height="128"></a>
</div>
<div id="font" class="wrapper">
<a id="about" href="about.html" class="stroke">
<font>ABOUT</a>
</font>
<a id="news" href="news.html" class="stroke">
<font>NEWS</a>
</font>
<a id="store" href="store.html" class="stroke">
<font>STORE</a>
</font>
<a id="music" href="music.html" class="stroke">
<font>MUSIC</a>
</font>
<a id="connect" href="connect.html" class="stroke">
<font>CONNECT</a>
</font>
<a id="submit" href="submit.html" class="stroke">
<font>SUBMIT</a>
</font>
</div>
【问题讨论】:
-
您的 HTML 不正确。除此之外,您应该为此使用列表! w3schools.com/css/css_navbar.asp
-
HTML @Timo002 有什么问题?我也将其更改为列表,谢谢您向我展示正确的方法。
-
<font>标签在 HTML5 中已弃用 -
所以我应该用列表格式重新格式化它?你知道这是否也能解决我的链接移动问题吗?我对此很陌生,对于业余的错误,我深表歉意。 @Wachtler
-
我觉得这个问题应该结束了:(
标签: html css position css-position