2016-03-13 124 views
2

我正在使用Onsen UI創建應用程序。我想減少名稱字段的高度。如何減少物品清單物品的高度?

我試圖改變的以下樣式的價值,但它不能被縮小到比它現在。

<ons-list-item style="height:50%;" > 

我該如何改變它的高度?

HTML

<ons-page> 
    <ons-toolbar> 
    <div class="right"><ons-toolbar-button>Cancel</ons-toolbar-button></div> 
    <div class="center">New Message</div> 
    </ons-toolbar> 

    <ons-list modifier="inset" style="margin-top: 10px"> 
    <ons-list-item class="to-wrapper"> 
     <ons-row> 
     <ons-col width="52px"> 
      <ons-icon icon="fa-user"></ons-icon> 
     </ons-col> 
     <ons-col> 
      <div class="to-name">Graham</div> 
      <div class="to-email">@graham</div> 
     </ons-col> 
     </ons-row> 
    </ons-list-item> 
    <ons-list-item style="height:50%;" > 
     <input type="text" class="text-input text-input--transparent" placeholder="Name (I'd like to change this height.)" style="width: 100%"> 
    </ons-list-item> 
    <ons-list-item> 
     <textarea class="textarea textarea--transparent" placeholder="Message" style="width: 100%; height: 100px;"></textarea> 
    </ons-list-item> 
</ons-page> 

CSS

.to-wrapper { 
    line-height: 1; 
    height: 62px; 
    padding: 10px; 
} 

.to-image { 
    width: 42px; 
    height: 42px; 
    border-radius: 4px; 
    -webkit-border-radius: 4px; 
} 

.to-name { 
    font-weight: 500; 
    font-size: 17px; 
    margin-bottom: 4px; 
} 

.to-email { 
    font-size: 14px; 
    opacity: 0.4; 
} 

.text-input { 
    margin-top: 4px; 
} 

.textarea { 
    margin-top: 4px; 
} 
.fa-user{ 
    font-size: 30px;  
}  

回答

3

<ons-list-item>設置屬性min-height,你需要重寫。所以這樣的事情應該工作:

<ons-list-item style="height:20px; min-height: 20px" > 
+0

它運作良好!在這樣一個簡單的代碼中,好的感覺非常驚奇。 – yuzu