首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >波旁酒整洁:如何扩展列以匹配外部容器?

波旁酒整洁:如何扩展列以匹配外部容器?
EN

Stack Overflow用户
提问于 2014-05-13 09:48:27
回答 3查看 2.8K关注 0票数 4

我正在测试Bourbon整洁,我在一个外容器中有两列,我希望这两列的高度相等(与最高的列一样高)。在short列上使用@include fill-parent不起作用,它只会使它与外部容器一样宽。我可以用javascript来做,但是不能很好的处理这个吗?

下面是我的html:

代码语言:javascript
复制
<section class="blog">

<article>
    <h1>How to set up Bourbon Neat</h1>
    <h2>Installing and using Bourbon</h2>
    <p>Install bourbon by going to your users directory in git bash, and typing: gem install bourbon</p>
    <p>Then change directory to your style folder and type in git bash: bourbon install</p>
    <p>Then, import the mixins at the top of your stylesheet(s): @import 'bourbon/bourbon'</p>
    <h2>Installing and using Neat</h2>
    <p>Install neat by going to your users directory in git bash, and typing: gem install neat</p>
    <p>Then change directory to your style folder and type in git bash: install neat</p>
    <p>Then, import the mixins at the top of your stylesheet(s): @import 'bourbon/bourbon'</p>
</article>

<aside>
    <!--<img src="style/images/cupman.gif" alt="It's bidness time">-->
    <p>It's bidness time</p>
</aside>

我是这么说的:‘

代码语言:javascript
复制
$visual_grid: true
$visual-grid-color: blue
$visual-grid-index: front
$visual-grid-opacity: 0.1

@import 'bourbon/bourbon'
@import 'neat/neat'

@import 'variables'



///////////////////////////
html
    @include linear-gradient(black, gray)
    height: 100%

body
    background-color: $baseColor
    font-family: $type


body *
    -webkit-box-sizing: border-box
    -moz-box-sizing: border-box    
    box-sizing: border-box         


//////////////////////////////


.blog
    @include outer-container
    aside
        @include span-columns(4)
        background: $thirdColor
        //height: 100%
        //@include fill-parent()
    article
        @include span-columns(8)
        background-color: $fourthColor
        padding: 5px
    margin-top: 40px
    background-color: $secondColor
`

感谢您的阅读。

编辑:目前,我只是使用jQuery手动均衡列大小,但如果有更好的方法(哈哈),请告诉我。

EN

回答 3

Stack Overflow用户

发布于 2014-10-13 14:45:48

要使列高度相等,一个解决方案是使所有父级都高度:100%。

使用您的示例:

代码语言:javascript
复制
html, body 
    height: 100%

.blog
    @include outer-container
    height: 100%
    aside
        @include span-columns(4)
        background: $thirdColor
        height: 100%
    article
        @include span-columns(8)
        background-color: $fourthColor
        padding: 5px
        height:100%

这应该是可行的

票数 0
EN

Stack Overflow用户

发布于 2014-11-19 19:52:17

要控制子对象的高度,首先需要设置其父对象的高度。然后,如果您想让两者具有相同的高度,只需使用min-height属性。

如下所示:

代码语言:javascript
复制
.blog {
  height: 100%;
  aside {
    min-height: 100%;
  }
}           

它应该是有效的。

票数 0
EN

Stack Overflow用户

发布于 2014-06-14 02:27:49

fill-parent仅使其成为容器的全宽,而不是全高。等同于:

代码语言:javascript
复制
.element {
  width: 100%;
  // Also sets box-sizing if global $border-box-sizing is set to 'false'
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

Source

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23621600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档