2015-07-11 77 views
1

我想在我的應用程序中使用一些角度的第三方庫傳送帶。此外,我正在使用Angular-Material進行佈局。問題是,當我插入<ul></ul>元素與此庫的指令,我的元素並不想與此內容舒展:Div並不與內部的內容拉伸

<div layout="row" layout-align="center center" layout-padding style="overflow-x: hidden; 
    overflow-y: hidden;"> 
    <div flex-sm="65" flex="40"> 
     <ul rn-carousel rn-carousel-transition="hexagon" rn-carousel-buffered 
      class="ul-carousel"> 
      <li ng-repeat="card in cards"> 
       <md-card> 
        <img imageonload="setImageLoading(imageLoading)" current-slide="carouselIndex" 
          ng-src="{{card.imageCoverRep.url}}" 
          ng-click="goCardDetails(card)"> 
       </md-card> 
      </li> 
     </ul> 
    </div> 
</div> 

這裏是旋轉木馬的CSS:

input[type=range] { 
    width:300px; 
} 

ul[rn-carousel] { 
    overflow:hidden; 
    padding:0; 
    white-space: nowrap; 
    position: relative; 
    perspective:1000px; 
    -ms-touch-action: pan-y; 
    touch-action: pan-y; 
    > li { 
    color:black; 
    backface-visibility: hidden; 
    overflow: visible; 
    vertical-align: top; 
    position:absolute; 
    left:0; 
    right:0; 
    white-space: normal; 
    padding:0; 
    margin:0; 
    list-style-type:none; 
    width:100%; 
    height:100%; 
    display:inline-block; 
    } 
} 

/* prevent flickering when moving buffer */ 
ul[rn-carousel-buffered] > li { 
    display:none; 
} 

ul[rn-carousel-transition="hexagon"] { 
    overflow:visible; 
} 

/* indicators */ 
div.rn-carousel-indicator span { 
    cursor:pointer; 
    color: #666; 
    &.active { 
    color: white 
    } 
} 

/* prev/next controls */ 
.rn-carousel-control { 
    transition: opacity 0.2s ease-out; 
    font-size: 2rem; 
    position: absolute; 
    top: 40%; 
    opacity: 0.75; 
    cursor: pointer; 
    &:hover { 
    opacity: 1; 
    } 

    &.rn-carousel-control-prev { 
    left: 0.5em; 
    &:before { 
     content: "<"; 
    } 
    } 

    &.rn-carousel-control-next { 
    right: 0.5em; 
    &:before { 
     content: ">"; 
    } 
    } 
} 
+3

如果您完全放置'li',那麼它們的大小將不會被父級考慮在內,因爲它們不再處於文檔流中。 –

回答

0

在我所看到的,你已經使用「position:absolute」作爲> li,嘗試刪除它並將其更改爲float。