-2
.topNav {
overflow: hidden;
background-color: #5e9da1;
}
/* Style the links inside the navigation bar */
.topNav a {
float: right;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.topNav a:hover {
background-color: #ddd;
color: #000000;
}
/* Add a color to the active/current link */
.topNav a.active {
background-color: #4CAF50;
color: #ffffff;
}
<div class="topNav">
<a class="active" href="#home">Home</a>
<a href="#About">About</a>
<a href="#Gallery">Gallery</a>
<a href="#Contact">Contact</a>
</div>
如何浮動錨點向右倒沒有他們之間的順序?
注:我能夠通過手動扭轉了HTML文件的錨點爲了解決這個問題,但我不知道這是一個妥善的解決辦法(好習慣)的問題: 例子:
<a href="#Contact">Contact</a>
<a href="#Gallery">Gallery</a>
<a href="#About">About</a>
<a class="active" href="#Home">Home</a>