html - 如何使右侧栏的高度与主要内容的高度一致

标签 html css twitter-bootstrap

我是 Twitter Bootstrap 框架和 CSS 的新手。

我希望右侧边栏的高度与主要内容的高度一致。我应该怎么做。

<!DOCTYPE HTML>
<html lang="en">
<head>
    <link href="includes/Bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="includes/Bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
    <div class="page-container">
        <div class="container">
            <div class="container-fluid">
                <header class="margin-top">
                    <div class="row-fluid">
                        <img border=0 src="images/header.jpg" alt="">
                    </div>
                </header>

                <div class="row-fluid">
                    <div class="span3">
                        <div class="well sidebar-nav">
                            <ul class="nav nav-list">
                                <li><a href="index.php">Home</a></li>
                                <li><a href="contact-us.php">Contact&nbsp;</a></li>
                                <li><a href="about-us.php">About&nbsp;Us</a></li>
                            </ul>
                        </div><!--/.well -->
                    </div><!--/span-->
                    <div class="span9">
                        <div class="hero-unit">
                            If I have a long content here.. The sidebar does not follow the height of the content.
                        </div>
                    </div><!--/span-->
                </div><!--/row-->
            </div><!--/.fluid-container-->
        </div>
    </div>
</body>
</html>

最佳答案

你的容器似乎没问题并且有自动高度那么问题是什么 在这里你看到 fiddle
http://jsfiddle.net/cancerian73/ZpZCD/

.container {background-color:#fc0;}

关于html - 如何使右侧栏的高度与主要内容的高度一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18077435/

相关文章:

html - Logo 链接在 Wordpress 网站上不可点击

PHP:将二维数组显示为具有模式形式的表格?

html - 如何将内容保留在 View 中?

javascript - 在没有自动调整的情况下将我的图像 slider 定位在屏幕上

php - 用于向 HTML 文档中的 .js 和 .css 引用添加版本号的正则表达式

html - 获取图像顶部的背景颜色

javascript - Bootstrap 选项卡正在运行但数据未显示?

javascript - Datagrid 中的 Bootstrap 开关

JQuery 子菜单滑出

CSS 简单的线条不起作用