Useful Tips for Structuring HTML & CSS

  • Apply margins or padding to containers rather than to individual elements. This makes it easy to keep margins consistent and to easily update later if needed.
  • When looking at a design, look for repeated elements and structures. Think about the most basic functions of these structures when coming up with class naming schemes.
  • Look at the functions of elements from general to more specific. For example, a design may include several types of “notices” such as for errors, warnings, and success messages. The design of these notices should normally be the same except for colors for example. So use a general classname for the basic “notice” styles together with a second classname for the type of notice that sets the colors.
  • Use basic semantic HTML tags. If you use semantic tags properly it’s not necessary to give everything a classname in order to distinguish seperate elements and your HTML documents will be more accessible and search-engine friendly.
Leave a comment

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s