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) Basic Layout Clearing Floats

Kevin Faust
Kevin Faust
15,353 Points

am i the only one that doesnt get whats going on

no matter how much i try to understand, everything is still bleh. like why do we have a div class with 3 names inside it? like "secondary-content" "t-border" and "group" is all under 1 div class. why is this? and then we style each one seprately like secondary-content { } as well as t-border { } and group { }. why not just do it in 1?

and i dont get what the function of the pseudo class ":after" is as well as everything that went inside the { }.

i know the basic concept of margins, padding, parent element, ,children element, and display but its still pretty hazy and im pretty sure if i were to attempt to build a website id probably crash and burn.

i just dont know if this is normal or if im supposed to be good at these basics by now. sortof demoralizing when i reflect on how much of nothing i know

Hi Kevin, It's a lot to learn for me too. I'm working through JavaScript at the same time, which is trickier :-0 It seems that repetition will help (?) Thank you for the question, as the answer helped me too :-)

Kevin Faust
Kevin Faust
15,353 Points

Hey Lucy, i learned that I just should not quit. it doesnt matter if im making barely any progress, as long as im getting constant exposure to these lessons, I will naturally progress. so rather than cramming information into my head, im just going to take it more slower. I hope we both never quit!!

Kevin Korte
Kevin Korte
28,149 Points

Repetition is key to getting it.

Hi Kevin,

Nick Pettit once said "The more you learn the more you realize how much you still have to learn ".

Recently, I signed up for the 14-day free trail at treehouse. I have been watching the videos every single day. Each day i learn a little bit more. Certain days i feel like I understand the concepts and then the following video makes me re-think again, maybe i don't understand it. But I just want to let you know you are not alone and to be patience. Take it day by day.

I also have the same question: When using the float clearfix property ( clear: both ) why must you create another class? How come you cannot just use the same secondary-content class since its the still the parent element div?

After my free-trail is over, I am definitely signing up. Thanks for all the knowledge team treehouse.

Kevin Faust
Kevin Faust
15,353 Points

Hey Kashin,

Great to hear your learning! Ah i remember writing this around 3 months ago. Back then I had no knowledge and wanted to quit alot. Ive been trying to learn almost everyday since thenand Ive just kept at it. Althought I sort of quit web development (turned towards java and android), Ive learned alot over my time here and when I feel frustrated, I look back and just see how far ive progressed. I wish you the best of luck,

Kevin

5 Answers

Kevin Korte
Kevin Korte
28,149 Points

Yes, its frustrating.

Yes, it'll start to make more sense. Stick with.

Yes, you need a cold drink, and take 45 minutes to watch this: https://www.youtube.com/watch?v=iniwPUEbPUM

(btw, Jacob Thornton is one of the creators of the Bootstrap framework)

Kevin Faust
Kevin Faust
15,353 Points

do u have the answer to this?

why do we have a div class with 3 names inside it? like "secondary-content" "t-border" and "group" is all under 1 div class. why is this? and then we style each one seprately like secondary-content { } as well as t-border { } and group { }. why not just do it in 1?

and i dont get what the function of the pseudo class ":after" is as well as everything that went inside the { }.

Kevin Faust
Kevin Faust
15,353 Points

and yea imma take a break

Kevin Korte
Kevin Korte
28,149 Points

The answers are much too large for a simple forum post, but I'll try

Why a div with 3 class names

Answer: Separation of styles. We want code to remain DRY (don't repeat yourself). Writing CSS classes that do too much, will eventually lead to having to re-write code. The strive is that a style gets defined in one spot, and is independent of other styles or modules it's attached to. In small projects, this type of thinking is overkill. As websites quickly scale, it becomes necessary or you end up in CSS hell.

Pseudo class

Answer: There are two, :before and :after, and they are like bonus layers each element has access to. Read this article for more information, and pictures! https://css-tricks.com/pseudo-element-roundup/

Oliver Sewell
Oliver Sewell
16,425 Points

i feel the same dude you should make a codepen and just mess around making different layouts its good because you dont need to put all the doctype and head stuff u can just start coding straight away

Hello Kevin F. Keep plugging away at your course!

Glad to hear you are persevering.

Ashkan Entezari
Ashkan Entezari
3,956 Points

I was totally lost when I saw the clearfix here, I was reading every resource to understand how it works. This question in Stackoverflow helped me a lot! First answer and second last one are precious!