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 Layout Techniques Display Modes Table Display

Matthew Barrus
Matthew Barrus
16,731 Points

an element can have more than one display type?

In the video at 2:47 he adds a table-cell display type to the classes that already have display: inline-block (main-logo and main-nav). I had to delete the inline-block display type before the table-cell would work but in the video he does not.

2 Answers

Benjamin Larson
Benjamin Larson
34,055 Points

Hi Matthew,

You can't have two display types simultaneously acting on an element. The inline-block display is being overwritten in the CSS below it to completely change the display mode to table-cell. This is part of the cascading nature of CSS, that any code below that applies a style to the same selection will overwrite the previous definition. I ran the code that Guil used in the video and it had the same effect whether or not I kept or deleted the inline-display for the .main-logo and .main-nav.

Matthew Barrus
Matthew Barrus
16,731 Points

Thank you very much! I had forgotten about that and my code was not in the right order!

Steven Parker
Steven Parker
229,732 Points

An element can have only one effective setting for each CSS property.

Remember in CSS only the latest defiinition of the same specificity is effective.

Are you adding the CSS selectors in the same order as shown in the video?

Matthew Barrus
Matthew Barrus
16,731 Points

Thank you!! Yes, I had forgotten this rule and my code was not in the correct order!