freeCodeCamp/guide/chinese/certifications/responsive-web-design/css-flexbox/use-the-flex-basis-property.../index.md

544 B

title localeTitle
Use the flex-basis Property to Set the Initial Size of an Item 使用flex-basis属性设置项的初始大小

使用flex-basis属性设置项的初始大小

使用flax-basis可以达到与前两个挑战相同的效果。 设置适当的值后,在应用任何收缩或增长之前,您将看到#box-2大于#box-1

#box-1 { 
  background-color: dodgerblue; 
  height: 200px; 
  flex-basis: 10em; 
 } 
 
 #box-2 { 
  background-color: orangered; 
  height: 200px; 
  flex-basis: 20em; 
 }