Web前端WEB前端程序开发web前端

Bootstrap3 - 13.导航栏中的搜索表单

2018-01-03  本文已影响2人  廖马儿

我们在:
http://getbootstrap.com/components/#glyphicons
可以找到所有我们可以使用到的小图标。

代码:

<!doctypoe html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width, scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
        <a href="#" class="navbar-brand">www.<strong>google</strong>.com</a>
        <ul class="nav navbar-nav">
            <li class="active"><a href="">课程</a></li>
            <li><a href="">博客</a></li>
            <li><a href="">手册</a></li>
            <form action="" class="navbar-form navbar-left">
                <input type="text" placeholder="搜索" class="form-control">
                <button type="submit">
                    <span class="glyphicon glyphicon-search"></span>
                </button>
            </form>
        </ul>
        </div>

    </nav>
    <div class="container" style="height:5000px;">  
        <div>
            <h1>title</h1>
            <p>按时打算是多少对方的方式斯蒂芬斯蒂芬按时打算</p>
        </div>
    </div>
    <script src="lib/jquery/jquery.min.js"></script>
    <script src="lib/bootstrap/js/bootstrap.min.js"></script>   
</body>
</html>

style.css:


body {
    padding-top: 52px;
}

.navbar-inverse input[type="text"] {

    background-color: #313131;
    border: none;
    color: #999;
}

.navbar-inverse .navbar-form {
    position: relative;
}

.navbar-inverse .navbar-form input{
    display: inline-block;
    width: 75%;
}



.navbar-inverse button[type="submmit"] {
    position: absolute;
    line-height: 34px;
    right: 20px;
    background-color: #555;
    border: none;
    display: inline-block;
}

.navbar-inverse .glyphicon {
    color: red;
}

效果:

图片.png

做的有点不好不要见笑。

上一篇下一篇

猜你喜欢

热点阅读