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 Basics (2014) Understanding Values and Units Percentages

Nick Ars
Nick Ars
5,341 Points

Can we add a common class for .primary-content and .secondary-content?

instead of writing: .primary-contetnt,
.secondary-content { }

2 Answers

Owa Aquino
Owa Aquino
19,277 Points

Hi Nick!

Yes we can, in the video Guil makes the classes different because they have different styling rule that are unique on that class.

.primary-content{
 //styles that specific only for primary class elements
}

.secondary-content{
//styles that specific only for secondary class elements
}

then you can also create a style that primary and secondary-content can share (using comma)

.primary-content,
.socondary-content {
  //shared style rule for primary and secondary
}

Or you could create a new class that you can add to your element (html element that having .primary-content or .secondary-content)

.new-class{
  //style rules for new class
}

you just have to add your .new-class both beside your primary and secondary-content <div> (or element).

<div class="primary-content new-clase">
  //your other html elements
</div

<div class="secondary-content new-class">
  //your other html elements
</div>

Hope this help. Cheers!

Owa

Nick Ars
Nick Ars
5,341 Points

Thank you very much)