Issue
I have 2 types of elements:
- Type "A" - text block
- Type "B" - graphical block
I need to make responsive layout, where on small resolution it should look like this:
"A" "A"
"B"
and on higher resolution it should look like this:
"A" "B" "A"
Do you have any ideas how to make or approach this task?
I am using tailwindcss
, but it's okay to use pure css
Solution
You can use display: flex
on the parent, and then give the children an order
. You can then change the order based on screenwith with media-queries.
.a {
order: 1;
}
.b {
order: 2;
}
@media screen and (min-width: 600px) {
.b {
order: 1;
}
}
In addition to reversing the order in which flex items are visually displayed, you can target individual items and change where they appear in the visual order with the order property.
The order property is designed to lay the items out in ordinal groups. What this means is that items are assigned an integer that represents their group. The items are then placed in the visual order according to that integer, lowest values first. If more than one item has the same integer value, then within that group the items are laid out as per source order.
Answered By - Dennis van de Hoef
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.