从选项卡底部到页脚顶部的垂直条布局

时间:2013-04-11 20:54:40

标签: html css

这个小提琴......

http://jsfiddle.net/jeljeljel/5BSva/6/

显示我想要实现的布局。我希望从标签底部的垂直条延伸到页脚。我以为我已将此修复,但当页面内容超出垂直高度时,垂直条不会调整。

有没有办法改变这个小提琴,以便垂直条总是延伸到页脚?

HTML

<div class="wrapper">
    <div class="header">
        HEADER
    </div>
    <div class="body">


        <ul class="nav nav-tabs" id="tabcontrol">
            <li class="active"><a href="#home" data-toggle="tab">Home</a></li>
        </ul>

        <div class="tab-content">
            <div class="tab-pane active" id="home" style="">
                <div class="navigation" style="">
                    navigation<br />
                    navigation<br />
                    navigation<br />
                </div>

                <div class="content">
                    <table>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                        <tr>
                            <td>some information</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>


    </div>
    <div class="push">
    </div>
</div>
<div class="footer center">
    <div style="border-bottom: 2px solid rgb(174, 174, 201); background-color: #fff;"></div>
    <div>
        FOOTER
    </div>
</div>

CSS

        .body {
            border: 1px solid rgb(174, 174, 201);
            border-top: 5px solid rgb(174, 174, 201);
            border-bottom: 5px solid rgb(174, 174, 201);
            border-left: 2px solid rgb(174, 174, 201);
            border-right: 2px solid rgb(174, 174, 201);
            padding-bottom: 1000px;
            margin-bottom: -1000px;
        }

        /* Sticky Footer by Ryan Fait (http://ryanfait.com/) */
        * {
            margin: 0;
        }

        html, body {
            height: 100%;

        }

        .wrapper {
            min-height: 100%;
            height: auto !important;
            height: 100%;
            margin: 0 auto -50px auto; /* the bottom margin is the negative value of the footer's height */
            overflow: hidden;
        }

        .footer {
            height: 50px;
            background-color: red;
        }

        .footer, .push {
            height: 50px; /* .push must be the same height as .footer */
            clear: both;
        }

        form {
            height: 100%;
        }
        /* Sticky Footer by Ryan Fait (http://ryanfait.com/) */

        .navigation {
            float: left;
            width: 150px;
            border-right: 3px solid rgb(174, 174, 201);
            padding-top: 10px;
            white-space: nowrap;
    position:absolute;

bottom:50px;
    top:65px;
        }

        .content {
            padding-top: 10px;
    margin-left:160px;
        }

        .nav {
            margin-bottom: 0px;
        }

1 个答案:

答案 0 :(得分:1)

实现此目标所需的最小css数量是将position: relative添加到.tab-pane,然后调整.navigation的顶部和底部值。这就是后者绝对定位所需要的东西。

见这里:http://jsfiddle.net/5BSva/11/