我試圖讓三個鏈接 - LOGO,關於和常見問題在同一行顯示,但我無法這樣做。看起來,我的nav-link
課程上留下的餘地正在搞砸了,但我不知道爲什麼。鏈接沒有與內聯塊排隊
body, html {
background-color: #EDEDED;
}
.nav {
position: absolute;
width: 80%;
margin: 5%;
}
.nav-link {
margin-left: 2%;
}
.nav-part {
display: inline-block;
}
.apply {
float: right;
position: relative;
right: 0;
top: 0;
}
<div class="nav">
<div class="nav-part">
<a href="/" class="brand-logo">LOGO</a>
<a href="/about" class="nav-link">About</a>
<a href="/faq" class="nav-link">FAQ</a>
</div>
<div class="apply nav-part">
<button>Apply</button>
</div>
</div>
這裏是我的jsfiddle - https://jsfiddle.net/hcrcba06/1/
只取利潤率左出,它工作正常。或將其更改爲更適合的東西(px,em) – ElefantPhace
[爲什麼邊緣/填充百分比總是按照寬度計算?](http://stackoverflow.com/questions/11003911/why-are-margin-padding-percentages -in-css-always-calculated-against-width) – Stickers