Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Flexbox Layout Flexbox Properties Smarter Layouts with flex-basis and flex

Justin Houghton
Justin Houghton
4,560 Points

Overriding flex-grow values

Does the following code essentially OVERRIDE the flex grow value for item-2 from 1 to 2 or am I misunderstanding what's happening?

The first snippet gives a flex grow value of 1 to all items. The second snippet re-defines the flex-grow value for item 2?

.item {
  flex: 1 200px;

}

.item-2 {
  flex-grow: 2;
}

1 Answer

Ryan M
Ryan M
16,509 Points

Yes! This is the 'cascading' part of CSS (Cascading Style Sheets). Regardless of how many rules apply to an element, only the last one is used.