怎么用CSSFrasbox創(chuàng)建一個CSS比較表

這篇文章主要介紹“怎么用CSS Frasbox創(chuàng)建一個CSS比較表”,在日常操作中,相信很多人在怎么用CSS Frasbox創(chuàng)建一個CSS比較表問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么用CSS Frasbox創(chuàng)建一個CSS比較表”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

創(chuàng)新互聯(lián)公司憑借在網(wǎng)站建設、網(wǎng)站推廣領域領先的技術能力和多年的行業(yè)經(jīng)驗,為客戶提供超值的營銷型網(wǎng)站建設服務,我們始終認為:好的營銷型網(wǎng)站就是好的業(yè)務員。我們已成功為企業(yè)單位、個人等客戶提供了網(wǎng)站建設、成都做網(wǎng)站服務,以良好的商業(yè)信譽,完善的服務及深厚的技術力量處于同行領先地位。

比較表是由多個相互堆疊的ULs組成的。我將使用CSS Flex框使它們都相等的寬度,并以相同的速率擴展和收縮,因此它們的行為與表中的行類似。

One

Two

Three

Four

Five

Six

Seven

Eight

Nine

Ten

Eleven

Twelve

Thirteen

Fourteen

Fifteen

Sixteen

Seventeen

Eighteen

Nineteen

Twenty

Twenty-one

Twenty-two

Twenty-three

Twenty-four

Twenty-five

Twenty-six

Twenty-seven

Twenty-eight

Twenty-nine

Thirty

Thirty-one

Thirty-two

Thirty-three

Thirty-four

Thirty-five

Thirty-six

Thirty-seven

Thirty-eight

Thirty-nine

Forty

Forty-one

Forty-two

Forty-three

Forty-four

Forty-five

Forty-six

Forty-seven

Forty-eight

Forty-nine

Fifty

Fifty-one

<div class="comparisontable">

    <ul class="row" &#62;

        <li class="legend">Office Chairs</li>

        <li><img src="Eurotech-chair.jpg"/><br />Eurotech</li>

        <li><img src="Hbada-chair.jpg"/><br />Hbada</li>

        <li><img src="Zenith-chair.jpg"/><br />Zenith</li>

        <li><img src="amazonbasics-chair.jpg"/><br />Amazonbasics</li>

    </ul>

    

    <ul class="row" &#62;

        <li class="legend">Weight</li>

        <li>25kg</li>

        <li>13kg</li>

        <li>17kg</li>

        <li>28kg</li>

    </ul>

    

    <ul class="row" &#62;

        <li class="legend">Cost</li>

        <li>$$</li>

        <li>$</li>

        <li>$$</li>

        <li>$</li>

    </ul>

    

    <ul class="row" &#62;

        <li class="legend">Delivery</li>

        <li>Domestic</li>

        <li>International</li>

        <li>International</li>

        <li>Domestic</li>

    </ul>

    

    <ul class="row" &#62;

        <li class="legend">Verdict</li>

        <li>Best ChairforBack Pain</li>

        <li>Best budget chair</li>

        <li>All MeshforCooling</li>

        <li>Only ChairwithTop Grain Leather</li>

    </ul>

    

    <ul class="row" &#62;

        <li class="legend"></li>

        <li><a href=""class="calltoaction">Buy Now</a></li>

        <li><a href=""class="calltoaction">Buy Now</a></li>

        <li><a href=""class="calltoaction">Buy Now</a></li>

        <li><a href=""class="calltoaction">Buy Now</a></li>

    </ul>

</div>

每個UL中的第一個Li元素是特征/圖例。為了輕松地將它們與其他的包裝不同,我把那些Li元素作為一個“傳奇”的CSS類。

CSS:

現(xiàn)在是有趣的部分-將標記轉換為比較表。使用CSS FrasBox,轉換UL元素相對容易,因此它們在布局、彎曲和拉伸方面是水平的,因此它們的行為更像表單元。

我已經(jīng)刪除了一些不必要的線,所以你可以把重點放在下面的重要位置:

One

Two

Three

Four

Five

Six

Seven

Eight

Nine

Ten

Eleven

Twelve

Thirteen

Fourteen

Fifteen

Sixteen

Seventeen

Eighteen

Nineteen

Twenty

Twenty-one

Twenty-two

Twenty-three

Twenty-four

Twenty-five

Twenty-six

Twenty-seven

Twenty-eight

Twenty-nine

Thirty

Thirty-one

Thirty-two

Thirty-three

Thirty-four

Thirty-five

Thirty-six

Thirty-seven

Thirty-eight

Thirty-nine

Forty

Forty-one

Forty-two

Forty-three

Forty-four

Forty-five

Forty-six

Forty-seven

Forty-eight

div.comparisontable{

    顯示:flex;

    FLEX-Direction:Column;/* turn children ul elements into stacked rows */

}

div.comparisontable ul.row{

    列表樣式:無;

    顯示:flex;/* turn children li elements into flex children */

    Flex:1;

    flex-wrap: wrap;

}

div.comparisontable ul.row li{

    背景:#c9f4ca;

    Flex:1;

    PADDING:10PX;

    Border-bottom:1px solid gray;

}

/* the legend column (first li within each row) */

div.comparisontable ul.row li.legend{

    背景:#6640d8;

    color: white;

    邊界:無;

    寬度:200px;

    border-bottom: 1px solid white;

}

/* very first row */

div.comparisontable ul.row:first-of-type li{

    Text-align:Center;

}

/* very last row */

div.comparisontable ul.row:last-of-type li{

    Text-align:Center;

    邊界底部:無;

    P.O.Box-Shadow:0 6PX 6PX RGBA(0.0,0.23);

}

/* first and last cell within legend column */

div.comparisontable ul.row:first-of-type li.legend.legend,

div.comparisontable ul.row:last-of-type li.legend{

    背景:透明;

    盒影:無;

}

“特征列表”或“傳奇”列是每行的第一個Li元素。它具有明確的寬度為200 px,不像其他的Li元素是Flex寬度(Flex:1)。

比較表的制作

現(xiàn)在,比較表沒有響應。也就是說,即使屏幕尺寸變得非常小,每行中的“列”仍然并排。

在CSS Flex框中,通過將Flex方向屬性從“行”設置為“列”,可以輕松地將Flex子元素的顯示順序從默認的“并排”行為改為“在下一個上疊加”。

現(xiàn)在在我的比較表中,UL元素本身是堆疊的,盡管孩子的Li元素像表中的單元格一樣并排出現(xiàn)。當屏幕足夠小的時候,我會把它們改成堆疊。

One

Two

Three

Four

Five

Six

Seven

Eight

Nine

Ten

Eleven

Twelve

Thirteen

Fourteen

Fifteen

Sixteen

Seventeen

Eighteen

Nineteen

Twenty

Twenty-one

Twenty-two

Twenty-three

Twenty-four

Twenty-five

Twenty-six

Twenty-seven

@media screen and (max-width:650px){

div.comparisontable ul.row{

    FLEX-Direction:Column;

}

div.comparisontable img{

    width: auto;

    高度:自動;

}

div.comparisontable ul.row li{

    margin-right: 0;

    width: auto;

    flex: auto;

}

/* first and last cell within legend column */

div.comparisontable ul.row:first-of-type li.legend.legend,

div.comparisontable ul.row:last-of-type li.legend{

    顯示:無;

}

div.comparisontable ul.row li.legend{

    width: auto;

}

}

現(xiàn)在,當我調(diào)整窗口大小時,比較表崩潰,每個“單元格”出現(xiàn)在自己的行上:

到此,關于“怎么用CSS Frasbox創(chuàng)建一個CSS比較表”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關知識,請繼續(xù)關注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

新聞標題:怎么用CSSFrasbox創(chuàng)建一個CSS比較表
網(wǎng)站路徑:http://bm7419.com/article0/jjspio.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站定制網(wǎng)站、網(wǎng)站改版企業(yè)網(wǎng)站制作、網(wǎng)站營銷、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設