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
Benjamin Hedgepeth
5,672 PointsPsuedo-class, classes and OOCSS
http://vanseodesign.com/css/object-oriented-css/
I want to use an example that obeys the principles of OOCSS as described in the link above.
http://codepen.io/BennyHH/pen/bprgxX
I would like this looked over to see if this completely adheres to the OOCSS principles. One thing I'm not certain is the border applied to the .wrap element. Would that require a separate class as well? I'm thinking it would because if a box shadow was applied to the box it would be a part of the presentation and not the structure of the element. Presentation (the skin) gets it's own class. Yet, a border is a part of the box model and forms the total (size/structure) of the element. While a visible border is optional it does give some presentation to an element.
Secondly, is the use of a child selector concurrent with the psuedo-class valid to give it more specificity given the first selector is not confined to a container because a class is used? I've read in another thread that someone was confused that :first-child was applied to child elements and not the parent container. With the use of child selector it seems to give it more meaning or is it best not use the child selector due to narrowing its scope of application?
HTML
<div class="wrap">
<section class="blog">
<p>Hello. I'm doing some HTML and CSS</p>
<p>Hello. I'm doing some HTML and CSS</p>
<p>Hello. I'm doing some HTML and CSS</p>
</section>
<section class="blog">
<p>Hello. I'm doing some HTML and CSS</p>
<p>Hello. I'm doing some HTML and CSS</p>
<p>Hello. I'm doing some HTML and CSS</p>
</section>
</div>
CSS
.wrap {
width: 800px;
margin: 100px auto;
}
.boxPresent {
border: 4px solid pink;
box-shadow: 0 9px 70px -20px green;
}
.blog {
border: 2px dotted navy;
margin: 10px;
}
.blog > p:first-child {
color: green;
font-weight: bold;
}