Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Create a clean billet table of COM and CSS Flexbox for CSS

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

A CSS and HTML com billet table is the main powerful way to communicate your product to visitors immediately, plus how they are different. In many cases, the com billet table and the price list are said on the same day. For me, a com billet table is that it should contain an additional column listing all the different features available. This makes it easy for COM to cut plans and isolate any differences about them.

HTML marker

For markings, I'm trying to make them as clean and simple as possible. I settled with an external main DIV element, followed by a series of UL columns to render each inner content "row" com billet table:

The com billet table is essential for components stacked against each other's multiple UI. I'll use CSS flex boxes to make them equal in width and expand and contract at the same rate, so they behave like rows in a table.

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

Office chair

Eurotech

Hbada

Zenith

Amazonbasics

Weight

25 kilograms

13 kilograms

17 kilograms

28 kilograms

Expenses

$

$

$

$

Put in

Domestic

International

International

Domestic

Sentence

Best back pain Chairman

Best budget chair

All cooling grids

Only top leather chairs.

Buy now

Buy now

Buy now

Buy now

The first LI element in each UL is the feature / legend. To make it easier to isolate and set them different from other wrappers, I give those LI elements a CSS class "legend".

CSS:

Now the fun part of COM ES rotates marked as com billet table. With CSS Flexbox, it is relatively easy to convert UL elements, so they are horizontal in layout, bending, and stretching, so they are more like table cells.

I deleted some unnecessary lines so that you can focus on the following important parts:

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 . Com compare {

Display: flex

Bend direction: column; / * convert child ul elements to stacked rows * /

}

DIV . Com compares ul.row {

List-style:none

Display: flex; / * convert children's li elements to flex children * /

Flex:1

Flex-wrap:wrap

}

DIV . Com parisontable ul.row li {

Background: # c9f4ca

Flex:1

Fill: 10px

Border-bottom:1px solid gray

}

/ * Legend column (first li in each row) * /

DIV . Com parisontable ul.row li.legend {

Background: # 6640d8

White color

Border:none

Width: 200px

Bottom of border: 1px pure white

}

/ * first line * /

DIV . Com parisontable ul.row:first-of-type li {

Text-align:center

}

/ * Last line * /

DIV . Com parisontable ul.row:last-of-type li {

Text-align:center

Border-bottom:none

Box-shadow:0 6px 6px rgba (0pd0re0j0pl 0.23)

}

/ * first and last cells in the legend column * /

DIV . Com parisontable ul.row:first-of-type li.legend.legend

DIV . Com parisontable ul.row:last-of-type li.legend {

Background: transparent

Box-shadow:none

}

The feature list or legend column is the first LI element in each row. Its explicit width is 200px, which is different from other flexible width LI elements (flex:1).

Make the comparison table respond

At present, the com Parison table is not responding. In other words, the "columns" in each row are still side by side and even the screen size is very small for the COM class.

In the CSS elastic box, we can easily change the display order of flex child elements from the default "side-by-side" behavior to "stack on top of the next" by setting the flex-direction property from "row" to "". Column ".

Now in my com blank table, the UL elements themselves are stacked, although the child Lee elements appear side by side as if they were in a table cell. When the screens become small enough, I change them to stack:

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 . Com compares ul.row {

Bend direction: column

}

DIV . Com parisontable img {

Width: automatic

Height: automatic

}

DIV . Com parisontable ul.row li {

Margin-right:0

Width: automatic

Flex:auto

}

/ * first and last cells in the legend column * /

DIV . Com parisontable ul.row:first-of-type li.legend.legend

DIV . Com parisontable ul.row:last-of-type li.legend {

Display:none

}

DIV . Com parisontable ul.row li.legend {

Width: automatic

}

}

Now, when I resize the window down, the com billet table crashes, and each "cell" appears on its own route:

Known problem

Last but not least, there is a small known problem with the com billet table. When you resize it, at certain intervals, the width of some LIS is COM synchronization a little bit:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report