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 Question for Pros

When styling your web pages do you know where to add padding and margins to separate your elements to make your layout look how you envisioned it in your head? or do you just guess and check?

Do you make comments in your css docs?

Grid systems definitely help a lot to create consistent space between elements on the page.

Outside of this, I tend to play around with the padding and margins in the browser (Chrome) until I get something I am happy with, either entering a specific value or using the up/down arrow keys to adjust live in the browser. The course below is great for this, only 35 mins and pays off quickly:

https://teamtreehouse.com/library/debugging-css-with-chrome-devtools

For me, one of best courses I completed anywhere was the one below:

https://teamtreehouse.com/library/web-typography

The last section on creating a typographic layout is awesome and still use what I learned everyday. Also noticing that frameworks like Bootstrap 4 have introduced padding and margin utility classes to help be consistent as well.

There are other things to take into consideration as well, like tap target sizes for accessibility, maybe different spacing for mobile devices etc.

Sometimes I will make comments in CSS, not for everything.

2 Answers

tor magne brekken
tor magne brekken
4,080 Points

if you dont have a design to go after. you guess an see if it's a good match for the design you have in your head. Dont need to be a pro to answer that :)

I always make comments in my code. do it in html, css, js, etc. I do it all over the place. it makes it easyer to read for other people and youself :)

Robbie Thomas
Robbie Thomas
31,093 Points

I have to agree with tor mange brekken and making comments on your code. If you haven't looked at it yet, you might want to give BootStrap a try.