嘗試這個 上#menu-list
刪除padding
,因爲#menu-list li
浮動到右,上#menu-list
使用clearfix
。
CSS
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
#rightpart {
position: relative;
float: right;
width: 40%;
}
#menu-list::after{
content:"";
display:table;
clear:both;
}
#menu-wrapper {
background-color: #3a3d40;
width: 100%;
z-index: 1000;
}
#menu-list {
height: 100%;
list-style: none;
list-style-type: none;
font-weight: normal;
font-family: 'Ubuntu', sans-serif;
font-weight: bold;
text-transform: uppercase;
margin: 0;
padding:0;
}
#menu-list li {
width: 50%;
height: 100%;
float: right;
}
#menu-list a {
display: block;
text-align: center;
text-decoration: none;
font-size: 12px;
color: #d4d4d4;
-webkit-transition:all 200ms ease-in;
-o-transition:all 200ms ease-in;
-moz-transition:all 200ms ease-in;
}
#menu-wrapper ul li.active a, #menu-wrapper ul li a:hover, #menu-wrapper ul li a.selected {
color: #86acc4;
background-color: red;
}
HTML
<div id='rightpart'>
<div id='menu-wrapper'>
<ul id='menu-list'>
<li><a>Playlists</a></li>
<li><a>Playlists</a></li>
</ul>
</div>
</div>
Link For Reference
_ 「我嘗試了很多東西」 _請告訴我們你試過 – j08691
你可以創建你的問題的例子嗎? https://jsfiddle.net/3x5Lzmwj/ – marekpw
2'播放列表'lis應該適合黑暗的div https://jsfiddle.net/3x5Lzmwj/8/ – Victofu