溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

AmazeUI折疊式卡片布局,整合內(nèi)容列表、表格組件的案例分析

發(fā)布時(shí)間:2021-03-20 10:59:40 來源:億速云 閱讀:221 作者:小新 欄目:web開發(fā)

這篇文章將為大家詳細(xì)講解有關(guān)AmazeUI折疊式卡片布局,整合內(nèi)容列表、表格組件的案例分析,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

折疊式卡片布局在PC版網(wǎng)站中可能不常見,但是在手機(jī)版,小屏幕的網(wǎng)頁瀏覽會(huì)大發(fā)異彩。

AmazeUI也提供了折疊式卡片布局,雖然官網(wǎng)上有例子,但是這種折疊式卡片布局,整合內(nèi)容列表、表格組件還是需要一番功夫。

比如下圖,利用AmazeUI的折疊式卡片布局,整合其提供的內(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">
        <!--自動(dòng)適應(yīng)移動(dò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>
        <h2>折疊式卡片布局</h2>
        <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ī)定好各行。

關(guān)于“AmazeUI折疊式卡片布局,整合內(nèi)容列表、表格組件的案例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI