如何调整导航栏内的导航项目的大小,以免他们流离失所?

时间:2017-12-16 21:24:06

标签: html css bootstrap-4

我遇到这个问题,导航栏内的导航项在移动纵向视图中移位。

在: enter image description here

重新调整后: enter image description here

我的目标是让导航栏中的项目在某一点之后缩小吗?如果是这样,我做错了什么?我是否对HTML代码或CSS代码进行了更改?我目前正在为这个项目使用bootstrap。

感谢。

.navbar {
    color: #FFFFFF;
    padding-left: 70px;
    align-content: center;

}


/*//padding for the nav bar menu items*/
 .nav>li>a {
        padding: 20px;
    }


.nav-tabs {
    margin-bottom: 15px;
}

.sign-with {
    margin-top: 25px;
    padding: 20px;
}
<html lang="en">

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<meta http-equiv="x-ua-compatible" content="ie=edge">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">


<link rel="stylesheet" type="text/css" href="CSS/WebsiteStyling.css" />
  
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>

</head>

<body data-spy="scroll" data-target="#navbar" data-offset="150">

    <nav class="navbar navbar-light bg-faded navbar-fixed-top" id="navbar">
        <a class="navbar-brand" href="demo.html">Home</a>
        <ul class="nav navbar-nav">
            <!-- <li class="nav-item">
                <a class="nav-link" href="#jumbotron">Buy<span class="sr-only">(current)</span></a>
            </li> -->
            <li class="nav-item">
                <a class="nav-link" href="agent.html">Agent</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="about.html">About</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" onclick="backButton()">back</a>
            </li>
            <li>
            </li>
        </ul>


        <!-- dropdown button -->

        <style type="text/css">
            @font-face {
                font-family: 'Glyphicons Halflings';
                src: url('/fonts/glyphicons-halflings-regular.eot');
            }
        </style>

        <div class="dropdown-button" id="dropdown">
            <div class="btn-group pull-right">
                <button type="button" class="btn btn-default dropdown-toggle pull-right" data-toggle="dropdown" id="dropdown">
                My Account<span class="caret"></span>
            </button>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="login.html">Login</a></li>
                    <li><a href="register.html">Register</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Account Setting</a></li>
                </ul>
            </div>
        </div>

    </nav>

0 个答案:

没有答案