手機版網站頂部導航條的布局


效果圖:

手機版網站頂部導航條布局分為3塊:
1、左側返回上一頁按鈕(固定寬高)
2、右側菜單按鈕(固定寬高)
3、中間文字介紹(寬度自適應且文字居中)

要實現這個效果最簡單的辦法是2邊絕對定位,中間text-align-center

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        body{padding:0;margin:0;}
        div, p, ul, ol, dl, dt, dd, form{margin:0;padding:0;}
        *{box-sizing:border-box;}
        .container-fluid{width:100%;min-height:50px;background:#080808;padding:0 10px;position:relative;}
        .navbar-brand{font-size:18px;height:50px;line-height:20px;padding:15px;position:absolute;left:0;top:0;z-index:1;}
        .navbar-text{line-height:50px;color:#ffffff;}
        .text-center{text-align:center;}
        .navbar-toggle{background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px;margin-bottom:8px;margin-right:15px;margin-top:8px;padding:9px 10px;position:absolute;right:0;top:0;z-index:1;}
    
    </style>
</head>
<body>
    <div class="container-fluid">
        <a class="navbar-brand" href="javascript:history.go(-1);">
            <span class="glyphicon glyphicon-menu-left"></span>
        </a>
        <p class="navbar-text text-center">商品詳情</p>
        <button class="navbar-toggle" data-target=".top-menu" data-toggle="collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
    </div>
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM