亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 CSS 中移動側邊欄

在 CSS 中移動側邊欄

斯蒂芬大帝 2024-01-22 15:44:19
.wrapper{    width: 1024px;    margin: auto;}.left-sidebar {    z-index: 9999;    width: 200px;    background: #303030;    height:100%;    overflow: auto;}#sidebar {    min-width: 200px;    min-height: 200px;    background: #303030;    color: #fff;    position:fixed;    transition: all 0.3s;    z-index:999;    height:100%;    width: 25%;    float: left;}<div class="wrapper">  <div class="left-sidebar">    <nav id="sidebar">我想將此側邊欄移至最左側和頂部。我嘗試刪除填充,但沒有填充,所以它什么也沒做。如何將側邊欄移動到最左側和最頂部?
查看完整描述

1 回答

?
忽然笑

TA貢獻1806條經驗 獲得超5個贊

既然你正在使用position: fixed. 只需在導航側邊欄容器中將top和css 屬性設置為 0 即可。left


.wrapper {

    width: 1024px;

    margin: auto;

}

.left-sidebar {

    z-index: 9999;

    width: 200px;

    background: #303030;

    height:100%;

    overflow: auto;

}

#sidebar {

    min-width: 200px;

    min-height: 200px;

    background: #303030;

    color: #fff;

    position: fixed;

    top: 0;

    left: 0;

    transition: all 0.3s;

    z-index: 999;

    min-height: 100%;

    width: 25%;

    float: left;

}

<div class="wrapper">

  <div class="left-sidebar">

    <nav id="sidebar">


查看完整回答
反對 回復 2024-01-22
  • 1 回答
  • 0 關注
  • 134 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號