草庐IT

css - 外部 DIV 不会随内部 DIV 扩展

coder 2023-08-02 原文

我将我的页面包装在主包装器 div 中,但外部 div 不会随着内部 div 展开。

我希望主要外部 div main-wrapper 的高度随着页面内容的增长而增长,但由于某种原因没有发生

我想弄清楚这个问题有一段时间了,但到目前为止没有成功。

我已经设置了jsFiddle Example

我会在这方面提供帮助。

HTML 结构示例

<!-- main Container -->
<div class="main-wrapper">
    <!-- Header -->
    <div class="header-wrapper"></div>
    <!-- Header -->
    <div class="content-wrapper">
        <!-- Content Page-->
        <!-- banner image wrapper -->
        <div class="top-image-wrapper"></div>
        <!-- banner image wrapper -->
        <!-- page content wrapper -->
        <div id="page-content-area" class="page-content-area">
            <div id="pg-intro-area" class="pg-intro-area">
                <div class="page-title">
                     <h5>Page Title </h5>

                </div>
                <div class="page-text"></div>
            </div>
            <div class="pg-right-bar-wrapper"></div>
        </div>
        <!-- page content wrapper -->
        <!-- Content Page-->
    </div>
    <div class="footer-wrapper"></div>
</div>
<!-- main Container -->

CSS 相关

html, body,form { height:100%;   background-color:gray; }
body {
  font-family:  Verdana,"Trebuchet MS",Arial,sans-serif;
   -webkit-font-smoothing: antialiased;
  font-size: 11px;
  line-height: 16px;
  height:100%; margin:0;padding:0; border:0;
  color:#656565;
}
p
{
    text-align:justify;
    color:#687074;
}
hr 
{
    background-color: #ccc;
    border: medium none;
    height: 1px;
    margin-bottom: 12px;
    margin-top: 12px;
}
h5 /* for page title*/
{
 font-size:15px;
 color:#028F41;   
 margin:5px 0;
}
.page-title-lbl
{
 font-size:15px;
 color:#028F41;   
 padding-left:105px;
 background-image:url("../images/title-bar.png");
 background-repeat:no-repeat; 
 text-shadow:0 0 0px #F6F6F6;
}
img
{
border:0px
}

a {
  color: #028F41;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

input {
    border: 1px solid #ccc;
    font-size: 12px;
    height: 20px;
    line-height:20px;
    vertical-align:middle;
    padding-left: 5px;
    color:#656565;
}
.btn 
{
    background-color: #0A8F36;
    border: 0 none;
    color: #FFFFFF;
    font-size: 12px;
    font-weight:bold;
    height: 24px;
    line-height:24px;
}

.margin5-0
{
    margin:5px 0;
}
.margin10-0
{
    margin:10px 0;
}
.margin20-0
{
    margin:20px 0;
}
.padding5-0
{
   padding:10px 0;
}
.padding10-0
{
   padding:10px 0;
}
.padding20-0
{
   padding:20px 0;
}
.margin10-000
{
    margin:10px 0 0 0;
}
.margin00-5-0
{
    margin:0 0 5px 0;
}
.margin00-10-0
{
    margin:0 0 10px 0;
}
.margin20-000
{
    margin:20px 0 0 0;
}
.margin00-20-0
{
 margin:0 0 20px 0;
}

.main-wrapper
{
    width:1000px;
    min-height: 100%;
    height: auto !important;
    height: 100%;
margin:0px auto 0px auto;
background-color:#fff;
padding-left:10px;
padding-right:10px;
}
.header-wrapper
{
height:130px;
background-color:red;

}
.search-sm-wrapper
{
    float:right;
    width:250px;
    height:100px;   
}
.search-wrapper
{
    text-align:right;
    width:250px;
    height:25px;
}
.txtSearch 
{
    float: right;
    height: 20px;
    width: 150px;
    border-right:0px;
}
.btn-search
{
float:right;
}

.language-wrapper
{
    float:right;
    text-align:right;
    width:250px;
    height:20px;
}
.language-link 
{
    color:#656565;
}
.sm-wrapper
{
    float:right;
    width:250px;
    height:25px;
}
.menu-wrapper
{
    height:30px;
    width:1000px;
    background-color:yellow;
}

.content-wrapper
{
float:left;
height:auto;
}
.footer-wrapper
{
    float:left;
    width:1000px;
}
.brand-logos
{
    height:39px;
}
.marquee
{
    float:left;
    overflow:hidden;
    height:39px;
    width:1000px;
    border:0px solid #f9f9f9;
}
.footer-banner
{
    float:left;
    height:96px;
    width:1000px;
}
.footer-menu
{
    display:none;
}
.footer-copyright
{
    float:left;
    height:20px;
    width:1000px;

}





.top-image-wrapper
{
    height:240px;
    margin-top:6px;
    background-color:#f5f5f5;
}


/* home page*/
.hp-intro-area
{
    float:left;
    width:570px;
    margin-right:30px;
}
.hp-right-bar-wrapper
{
    float:left;   
    width:400px;
}
.tabs-wrapper
{
  margin:10px 0;
  background-color:#E5E5E5;
  height:210px;
  overflow:hidden;
}
.tab-name-wrapper
{
  width:400px;
  height:30px;
  line-height:30px;
  background-color:#fff;
  margin-bottom:10px;
  overflow:hidden;
}
.tab-content-wrapper
{
 margin:0px 10px;
}
.hp-tab-image
{
    float:left;
    width:100px;
    padding-right:10px;    
}

/* Page */
.page-content-area
{
    width:100%;
    height:100%;
}
.page-sub-menu
{
    width:100%;
    height:23px;
    padding:0px 0px;
    background-color:blue;
}
.pg-intro-area
{
    float:left;
    width:570px;
    margin-right:30px;
}
.pg-right-bar-wrapper
{
    float:left;   
    width:400px;
}

最佳答案

.main-wrapper{
    overflow:auto;
    /* other styles here */
}

或者有时它只是有助于正确清除 float :

.main-wrapper:before,
.main-wrapper:after {
    content : "";
    display : table;
}
.main-wrapper:after {
    clear : both;
}

关于css - 外部 DIV 不会随内部 DIV 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18557285/

有关css - 外部 DIV 不会随内部 DIV 扩展的更多相关文章

  1. ruby - capybara field.has_css?匹配器 - 2

    我在MiniTest::Spec和Capybara中使用以下规范:find_field('Email').must_have_css('[autofocus]')检查名为“电子邮件”的字段是否具有autofocus属性。doc说如下:has_css?(path,options={})ChecksifagivenCSSselectorisonthepageorcurrentnode.据我了解,字段“Email”是一个节点,因此调用must_have_css绝对有效!我做错了什么? 最佳答案 通过JonasNicklas得到了答案:No

  2. ruby - 使用 C 扩展开发 ruby​​gem 时,如何使用 Rspec 在本地进行测试? - 2

    我正在编写一个包含C扩展的gem。通常当我写一个gem时,我会遵循TDD的过程,我会写一个失败的规范,然后处理代码直到它通过,等等......在“ext/mygem/mygem.c”中我的C扩展和在gemspec的“扩展”中配置的有效extconf.rb,如何运行我的规范并仍然加载我的C扩展?当我更改C代码时,我需要采取哪些步骤来重新编译代码?这可能是个愚蠢的问题,但是从我的gem的开发源代码树中输入“bundleinstall”不会构建任何native扩展。当我手动运行rubyext/mygem/extconf.rb时,我确实得到了一个Makefile(在整个项目的根目录中),然后当

  3. ruby - Highline 询问方法不会使用同一行 - 2

    设置:狂欢ruby1.9.2高线(1.6.13)描述:我已经相当习惯在其他一些项目中使用highline,但已经有几个月没有使用它了。现在,在Ruby1.9.2上全新安装时,它似乎不允许在同一行回答提示。所以以前我会看到类似的东西:require"highline/import"ask"Whatisyourfavoritecolor?"并得到:Whatisyourfavoritecolor?|现在我看到类似的东西:Whatisyourfavoritecolor?|竖线(|)符号是我的终端光标。知道为什么会发生这种变化吗? 最佳答案

  4. ruby-on-rails - 项目升级后 Pow 不会更改 ruby​​ 版本 - 2

    我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby​​版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby​​版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘

  5. ruby-on-rails - Nokogiri:使用 XPath 搜索 <div> - 2

    我使用Nokogiri(Rubygem)css搜索寻找某些在我的html里面。看起来Nokogiri的css搜索不喜欢正则表达式。我想切换到Nokogiri的xpath搜索,因为这似乎支持搜索字符串中的正则表达式。如何在xpath搜索中实现下面提到的(伪)css搜索?require'rubygems'require'nokogiri'value=Nokogiri::HTML.parse(ABBlaCD3"HTML_END#my_blockisgivenmy_bl="1"#my_eqcorrespondstothisregexmy_eq="\/[0-9]+\/"#FIXMEThefoll

  6. c - mkmf 在编译 C 扩展时忽略子文件夹中的文件 - 2

    我想这样组织C源代码:+/||___+ext||||___+native_extension||||___+lib||||||___(Sourcefilesarekeptinhere-maycontainsub-folders)||||___native_extension.c||___native_extension.h||___extconf.rb||___+lib||||___(Rubysourcecode)||___Rakefile我无法使此设置与mkmf一起正常工作。native_extension/lib中的文件(包含在native_extension.c中)将被完全忽略。

  7. css - 用 watir 检查标签类? - 2

    我有一个div,它根据表单是否正确提交而改变。我想知道是否可以检查类的特定元素?开始元素看起来像这样。如果输入不正确,添加错误类。 最佳答案 试试这个:browser.div(:id=>"myerrortest").class_name更多信息:http://watir.github.com/watir-webdriver/doc/Watir/HTMLElement.html#class_name-instance_method另一种选择是只查看具有您期望的类的div是否存在browser.div((:id=>"myerrortes

  8. ruby - 如何使用 Selenium Webdriver 根据 div 的内容执行操作? - 2

    我有一个使用SeleniumWebdriver和Nokogiri的Ruby应用程序。我想选择一个类,然后对于那个类对应的每个div,我想根据div的内容执行一个Action。例如,我正在解析以下页面:https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=puppies这是一个搜索结果页面,我正在寻找描述中包含“Adoption”一词的第一个结果。因此机器人应该寻找带有className:"result"的div,对于每个检查它的.descriptiondiv是否包含单词“adoption

  9. ruby-on-rails - 向 Rails 3 添加 Ruby 扩展方法的最佳实践? - 2

    我有一个要在我的Rails3项目中使用的数组扩展方法。它应该住在哪里?我有一个应用程序/类,我最初把它放在(array_extensions.rb)中,在我的config/application.rb中我加载路径:config.autoload_paths+=%W(#{Rails.root}/应用程序/类)。但是,当我转到railsconsole时,未加载扩展。是否有一个预定义的位置可以放置我的Rails3扩展方法?或者,一种预先定义的方式来添加它们?我知道Rails有自己的数组扩展方法。我应该将我的添加到active_support/core_ext/array/conversion

  10. ruby - 从外部访问类的实例变量 - 2

    我理解(我认为)Ruby中类变量和类的实例变量之间的区别。我想知道如何从该类外部访问该类的实例变量。从内部(即在类方法中而不是实例方法中),它可以直接访问,但是从外部,有没有办法做MyClass.class.[@$#]variablename?我没有任何具体原因要这样做,只是学习Ruby并想知道是否可行。 最佳答案 classMyClass@my_class_instance_var="foo"class上述yield:>>foo我相信Arkku演示了如何从类外部访问类变量(@@),而不是类实例变量(@)。我从这篇文章中提取了上述内

随机推荐