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!

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 Building a Layout with Flexbox Creating a Three Column Layout with Flexbox

why is the class named "primary" "secondary"while in the html file the class is set to "primary col" and "secondary col"

basically what title said

Basically since the class had a space in it, the <div> is assigned a class named "primary or secondary" and a class named "col". so thats why its valid to just have "primary" or "secondary" in the CSS file. They are treated as two classes sharing the same <div> tag. if they had a '-' instead of space then they are one.

1 Answer

Steven Parker
Steven Parker
228,039 Points

An element can have any number of classes. So primary col gives the element the class "primary" and the class "col", and it will respond to styling defined for both classes. Any conflicts in the settings are resolved by the cascade rules of CSS.