1 回答

TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超8個(gè)贊
float:right從元素中刪除#menu,因此它將占據(jù)整個(gè)水平空間,并將背景和填充移動(dòng)到內(nèi)部鏈接
$(document).ready(
function() {
$("#menu").click(function() {
$("#submenu").toggle(1000);
});
}
);
a {
color: #ffffff;
text-decoration: none;
}
#menu {
text-align: right;
}
#menu a {
background:#000000;
padding: 14px;
display: inline-block;
}
#submenu {
display: none;
width: 90%;
background: green;
color: #ffffff;
padding: 14px;
float: right;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="menu"><a class="limbo" href="#">MENU</a></div>
<div id="submenu"><a href="#">SUB MENU</a></div>
- 1 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報(bào)