Am I doing this right?

Am I doing this right?
0

#1

Survey Project http://codepen.io/codejsp/pen/MJOZxZ
Working on this project wondering if my code formatting looks good. Just learned about semantics so I was trying to implement those. What I have so far was enough to pass the survey project from beta.freecodecamp.com

Also, how should I organize my CSS? By class, id or different sections, etc?


#2

Hey codejsp,

You are doing it right. I would recommend using classes for CSS unless you need one item to be different from other items and in that case use and id. By using classes for majority of your code then you create it once and use it multiple times. For example you can create a class
.red-text { color: red; }
then you can apply that class to multiple items. You can even string classes together on an item. You can have a class of
.bold-text {
font-weight: bold;
}
Then you can have an item like

Jennifer


#3

Ah ok, I see now. Thanks for the advice, will be doing that from now on. :relaxed:


#4

When I’m being good and organized, I usually do a general section - styles that cover the whole document, and follow that with specific page sections - i.e. all the formatting for the header section, followed by content section (and this will sometimes be divided into subsections) followed by footer. It can get unwieldy so the best thing I’ve found to do is create a comment header for each section - that way it catches your eye as you scroll down - and also a search will take you to that part of the document quickly.


#5

It can get unwieldy so the best thing I’ve found to do is create a comment header for each section

Could you clarify? I don’t understand what you mean. Create a header for each section?


#6

`Sure - I mean something like this - which is sure to stand out when scrolling down -

/******************************************
* 
*   __footer section
*
******************************************/

Also I usually put something in front of the section name (body, header, footer) - since the word may be repeated in the document and the search may jump me to the wrong point if I enter just ‘footer’. Entering ‘__footer’ as a search will take me right to the start of the section. Hope this helps.


#7

Thanks again, I understand now.