App下載

快速了解AmazeUI折疊式卡片布局、整合內(nèi)容列表和表格組件實(shí)現(xiàn)操作步驟分享!

陳情匿舊酒 2021-08-19 10:12:53 瀏覽數(shù) (1802)
反饋

在我們?nèi)粘P』锇閭冊谑褂檬謾C(jī)或者電腦的時(shí)候在遇到折疊式卡片布局的時(shí)候在PC版網(wǎng)站與在手機(jī)版中網(wǎng)頁瀏覽會大發(fā)異彩。那么今天小編就來分享關(guān)于:“快速了解AmazeUI折疊式卡片布局、整合內(nèi)容列表和表格組件實(shí)現(xiàn)操作步驟分享!”這方面的內(nèi)容和代碼分享,希望對小伙伴們有所幫助!

如下圖所示,利用AmazeUI的折疊式卡片布局,整合其提供的內(nèi)容列表與表格組件。

整個(gè)頁面的代碼如下:

<!--使用HTML5開發(fā)-->
<!doctype html>
<html class="no-js">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!--自動適應(yīng)移動屏幕-->
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!--優(yōu)先使用webkit內(nèi)核渲染-->
        <meta name="renderer" content="webkit">
        <!--不要被百度轉(zhuǎn)碼-->
        <meta http-equiv="Cache-Control" content="no-siteapp"/>
        <!--以下才是引入amazeui資源-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <!--引入js的時(shí)候要注意,必須先引入jQuery,再引入amazeui,因?yàn)檫@個(gè)框架是基于jQuery開發(fā)的-->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/amazeui.min.js"></script>
        <title>折疊式布局下的內(nèi)容列表、表格</title>
    </head> 
    <body>
        <h1>折疊式卡片布局</h1>
        <div data-am-widget="accordion" class="am-accordion am-accordion-gapped">
            <!--這里是表示標(biāo)題的背景顏色是灰色-->
            <dl class="am-accordion-item am-active">
                <dt class="am-accordion-title">卡片1-文字</dt>
                <!--這里表示這個(gè)面板默認(rèn)是打開狀態(tài)-->
                <dd class="am-accordion-bd am-collapse am-in">
                    <div class="am-accordion-content">
                    <!--內(nèi)容在這里寫-->
                    純屬文字
                    </div>
                </dd>
            </dl>
            <dl class="am-accordion-item">
                <dt class="am-accordion-title">卡片2-內(nèi)容列表</dt>
                <dd class="am-accordion-bd am-collapse">
                    <!--如果這個(gè)折疊式布局里面用到的不是純屬的文件,必須加上一個(gè)margin-bottom:-20px削去底部的空白-->
                    <!--用到內(nèi)容列表的話,無須加class="am-accordion-content"屬性-->
                    <div style="margin-bottom:-20px">
                        <div class="am-list-news-bd">
                        <ul class="am-list">
                            <li class=" am-list-item-dated">
                                <a href="##" class="am-list-item-hd">標(biāo)題1</a>
                                <span class="am-list-date">2015-05-12</span>
                            </li>
                            <li class=" am-list-item-dated">
                                <a href="##" class="am-list-item-hd">超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長標(biāo)題2</a>
                                <span class="am-list-date">2015-05-12</span>
                            </li>
                            <li class=" am-list-item-dated">
                                <a href="##" class="am-list-item-hd">標(biāo)題3</a>
                                <span class="am-list-date">2015-05-12</span>
                            </li>   
                        </ul>
                        </div>
                    </div>
                </dd>
            </dl>
            <dl class="am-accordion-item">
                <dt class="am-accordion-title">卡片3-表格</dt>
                <dd class="am-accordion-bd am-collapse ">
                    <!--am-table-bordered代表表格列與列之間有線劃分,am-table-striped代表表格灰白相間-->
                    <div class="am-accordion-content" style="margin-bottom:-20px">
                        <table class="am-table am-table-radius am-table-striped">
                            <thead>
                                <tr>
                                    <!--這里與HTML一樣,必須設(shè)置好每一行的表格寬度-->
                                    <th width="33%">表頭1</th>
                                    <th width="33%">表頭2</th>
                                    <th>表頭3</th>
                                </tr>
                             </thead>
                             <tbody>
                                <tr>
                                    <td>內(nèi)容1</td>
                                    <td>超長超長超長內(nèi)容2</td>
                                    <td>內(nèi)容3</td>
                                </tr>
                                <tr>
                                    <td>內(nèi)容1</td>
                                    <td>超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長超長內(nèi)容2</td>
                                    <td>內(nèi)容3</td>
                                </tr>
                                <tr>
                                    <td>內(nèi)容1</td>
                                    <td>超長超長超長內(nèi)容2</td>
                                    <td>內(nèi)容3</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </dd>
            </dl>
        </div>
    </body>
</html>

關(guān)鍵的地方,注釋都有注釋了。也提供了超長內(nèi)容的處理方式。

dl-dt-dd是HTML中原生態(tài)的列表布局,與ul-li這一組是一樣地位,但是用得少,可能給人淡忘了。

如果AmazeUI的折疊式卡片布局里面要整合組件,必須移除底部那20px的留白,否則很難看的。感覺這個(gè)組件專門為文字設(shè)置的,框架的原義不希望你整合東西。

同時(shí)表格注意設(shè)置好第一行的各個(gè)寬度,以規(guī)定好各行。

簡單的描述都比不上使用代碼進(jìn)行一個(gè)實(shí)操上手,相信在通過本文章小伙伴們對于“快速了解AmazeUI折疊式卡片布局、整合內(nèi)容列表和表格組件實(shí)現(xiàn)操作步驟分享!”這個(gè)方面的使用和實(shí)現(xiàn)方法有了自己的想法,當(dāng)然如果你想學(xué)更多AmazeUI這方面的內(nèi)容我們都能在AmazeUI教程手冊中進(jìn)行學(xué)習(xí)和了解! 


0 人點(diǎn)贊