Issue
I want my elements to be in the middle of the screen and arranged vertically when on the mobile phone, but when switching to the tablet, the screen I hope to present is two elements in a row, presented from left to right!
Attached is the schematic diagram, but I'm stuck and don't know how to implement such a layout.
ul {
display: flex;
flex-direction: column;
align-items: center;
}
@media (min-width: 768px) {
ul {
flex-direction: row;
}
}
<ul>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
</ul>
Solution
Is this what you are looking for?
ul {
display: flex;
flex-direction: column;
align-items: center;
}
@media (min-width: 768px) {
ul {
flex-direction: row;
flex-wrap:wrap
}
li {
min-width:50%
}
<ul>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
</ul>
Answered By - Erfan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.