为了账号安全,请及时绑定邮箱和手机立即绑定

导航栏下的 div 宽度为 100% 显示滚动条

导航栏下的 div 宽度为 100% 显示滚动条

慕斯王 2023-10-10 15:20:28
嘿伙计们,我希望你们一切都好,所以我正在制作一个页面。主要有一个导航栏,在导航栏下面有一个引导网格和一个页脚..所以我想显示页面,因为导航栏和页脚之间的网格覆盖了em之间的空间,为此我使用了行的宽度100%,但是它似乎不起作用。这是我的代码。因此它成为每个设备的单个页面。没有滚动条索引.php<html><head>    <title></title>    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/a076d05399.js"></script><link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"><link rel="stylesheet" type="text/css" href="css/main.css"></head><body>    <!-- NAVBAR -->            <nav class="navbar navbar-light main_nav">                <i class="fas fa-bars"></i>                <div class="logo mr-auto">                    <img class="navbar-brand" src="images/michatroom.png" width="150">                </div>            </nav>    <!-- NAVBAR END -->    <div class="container-fluid">        <div class="row my_row">            <div class="col-md-2">                www            </div>            <div class="col-md-8">                www            </div>            <div class="col-md-2">                www            </div>        </div>    </div>
查看完整描述

1 回答

?
MMMHUHU

TA贡献1834条经验 获得超8个赞

只需将overflow:hidden添加到css的body中


body{

overflow:hidden;

}


* { margin:0; padding:0; }

.main_nav {

    background: #006080;

}

.logo {

    margin-left: 10px;

}

.my_row > div {

    border: 1px solid black;

}

.my_row {

    height: 100%;

}

<html>

<head>

    <title></title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>

<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

<script src="https://kit.fontawesome.com/a076d05399.js"></script>

<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">

<link rel="stylesheet" type="text/css" href="css/main.css">

</head>

<body>

    <!-- NAVBAR -->

            <nav class="navbar navbar-light main_nav">

                <i class="fas fa-bars"></i>

                <div class="logo mr-auto">

                    <img class="navbar-brand" src="images/michatroom.png" >

                </div>

            </nav>

    <!-- NAVBAR END -->


    <div class="container-fluid">

        <div class="row my_row">

            <div class="col-md-2" style='width:20%'>

                www

            </div>

            <div class="col-md-8" style='width:60%'>

                www

            </div>

            <div class="col-md-2" style='width:20%'>

                www

            </div>

        </div>

    </div>

    <nav class="navbar navbar-bottom navbar-light bg-faded">

  <a class="navbar-brand" href="#">Fixed bottom</a>

</nav>

</body>

</html>


查看完整回答
反对 回复 2023-10-10
  • 1 回答
  • 0 关注
  • 122 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信