ionic 按鈕
按鈕是行動app不可或缺的一部分,不同風格的app,需要的不同按鈕的樣式。
預設情況下,按鈕顯示樣式為:display: inline-block。
<button class="button"> Default </button> <button class="button button-light"> button-light </button> <button class="button button-stable"> button-stable </button> <button class="button button-positive"> button-positive </button> <button class="button button-calm"> button-calm </button> <button class="button button-balanced"> button-balanced </button> <button class="button button-energized"> button-energized </button> <button class="button button-assertive"> button-assertive </button> <button class="button button-royal"> button-royal </button> <button class="button button-dark"> button-dark </button>
button-block 樣式按鈕顯示為:display: block,它將完全填滿父元素的寬度,包含了內邊距屬性padding。
<button class="button button-block button-positive"> Block Button </button>
使用 button-full 類,可以讓按鈕顯示完全寬度,且不包含內邊距padding。
<button class="button button-full button-positive"> Full Width Block Button </button>
#不同大小的按鈕
button-large 設定為大按鈕,button-small 設定為小按鈕。
<button class="button button-small button-assertive"> Small Button </button> <button class="button button-large button-positive"> Large Button </button>
#無背景按鈕
button-outline 設定背景為透明。
<button class="button button-outline button-positive"> Outlined Button </button>
無背景與邊框按鈕
button-clear 設定按鈕背景為透明,且無邊框。
<button class="button button-clear button-positive"> Clear Button </button>
圖示按鈕
我們可以在按鈕上新增圖示。
<button class="button"> <i class="icon ion-loading-c"></i> Loading... </button> <button class="button icon-left ion-home">Home</button> <button class="button icon-left ion-star button-positive">Favorites</button> <a class="button icon-right ion-chevron-right button-calm">Learn More</a> <a class="button icon-left ion-chevron-left button-clear button-dark">Back</a> <button class="button icon ion-gear-a"></button> <a class="button button-icon icon ion-settings"></a> <a class="button button-outline icon-right ion-navicon button-balanced">Reorder</a>
頭部/底部新增按鈕
頭部/底部可以新增按鈕,按鈕的樣式根據頭部/底部來設定,所以你不需要為按鈕添加額外的樣式。
<div class="bar bar-header"> <button class="button icon ion-navicon"></button> <h1 class="title">Header Buttons</h1> <button class="button">Edit</button> </div>
button-clear 類別可以設定無背景和邊框的頭部/底部按鈕。
<div class="bar bar-header"> <button class="button button-icon icon ion-navicon"></button> <div class="h1 title">Header Buttons</div> <button class="button button-clear button-positive">Edit</button> </div>
按鈕列
我們可以使用 button-bar 類別來設定按鈕列。以下實例中,我們在頭部和內容中新增了按鈕欄。<div class="button-bar"> <a class="button">First</a> <a class="button">Second</a> <a class="button">Third</a> </div>