Fixed positioning css

Fixed positioning means positioning relative to the browser window. How the page scrolls, the position of this box does not change.
Fixed positioning away from the standard flow.
Purpose:
1. The css code of the top navigation bar:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>固定定位</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            padding-top: 60px;
        }
        .nav{
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 60px;
            background: #1c8de0;
        }
        .inner_c{
            width: 1000px;
            height: 60px;
            margin: 0 auto;
        }
        .inner_c ul{
            list-style: none;
        }
        .inner_c ul li {
            float: left;
            width: 100px;
            height: 60px;
            line-height: 60px;
            text-align: center;
            color: #fff;
        }
    </style>
</head>
<body>
    <div class="nav">
        <div class="inner_c">
            <ul>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
                <li>网页栏目</li>
            </ul>
        </div>
    </div>
</body>
</html>

Note: IE6 is not compatible with fixed positioning

Guess you like

Origin blog.csdn.net/u010256329/article/details/83584931