flex-basis and width
Hi,
Currently, my work has
main {
display: flex;
}
.col1 {
flex-basis: 30%;
}
.col2 {
flex-basis: 15%;
}
.col3 {
flex-basis: 55%;
}
If I replace flex-basis with width, is there any difference?
Hosun Kang

Hi,
Currently, my work has
main {
display: flex;
}
.col1 {
flex-basis: 30%;
}
.col2 {
flex-basis: 15%;
}
.col3 {
flex-basis: 55%;
}
If I replace flex-basis with width, is there any difference?
Hosun Kang

Hosun wrote
Hi,
Currently, my work has
main {
display: flex;
}
.col1 {
flex-basis: 30%;
}
.col2 {
flex-basis: 15%;
}
.col3 {
flex-basis: 55%;
}
If I replace flex-basis with width, is there any difference?
Hosun Kang
No, there is no difference. The formatting will remain the same. There may be ocassions where flex-basis has some advantages (although I dont specifically know that to be true) but as you're specifying a percentage width for each column there will be none in this instance.
Read more here
https://gedd.ski/post/the-difference-between-width-and-flex-basis/
From what I can deduce px width is used but since I rarely if ever use px width I have never encountered issues with either specifying a column percentage width using flex-basis or width.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.