我使用mincss及其導航欄,但我努力創建一個右對齊的鏈接。該鏈接顯示在右側,但其垂直位置不一致。mincss右對齊navbar
這是我到目前爲止有:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://mincss.com/entireframework.min.css" />
</head>
<body>
<nav class="nav" tabindex="-1" onclick="this.focus()">
<div class="container" style="overflow: hidden;margin-top: 0px;">
<a class="pagename current" href="#">My Title Here</a>
<a href="#">item</a>
<a href="#">item</a>
<a href="#" style="float: right;">item</a>
</div>
</nav>
<button class="btn-close btn btn-sm">×</button>
</body>
</html>
正如你所看到的,將不能正常使用的這兩個項目對準右側的最後一個項目左邊。
這是因爲標題和下一個元素的文本高度不同。當元素向右浮動時,它似乎忘記了我收集的垂直位置。
有沒有辦法解決這個問題?
提供的jsfiddle解決你的問題 – Thinker
@Thinker還好,補充說。 – Mew