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

HTML

HTML and Formating - Nick HTML course

I think Nick forgot something in his HTML course. In the beginning he said that the HTML is used for structure and CSS is used for how things are displayed.

Then in some videos of HTML he said that these elements are used to format.... The word format here I think it is used for formatting rather than structure, am I right?

2 Answers

Well, it isn't strictly one or the other between HTML or CSS. Often, it's a combination of both that actually makes your page look the way you want it to look. There are some formatting options built into HTML, but oftentimes it is better to format through CSS.

For example, many webpages (including the Smells Like Bakin' website you create through Treehouse) utilize a grid system to place the elements across a page. The actual spacing of each grid column is handled through CSS, but we have to "attach" the CSS to HTML elements in order for them to work together. This is done through applying a grid class to an html element, for example:

<div class="grid_12">Stuff in here</div>

By assigning this div with the class "grid_12", the webpage, when loaded, will look to CSS for the class "grid_12" and use the attributes applied to it.

If this doesn't make sense, I apologize. The grid system is covered in the videos, and if you haven't gotten there yet this might make a bit more sense once you do. Just know that while there is occasionally an overlap between HTML and CSS, the two of them working together are what creates the look and layout of your webpage.

Well I think that what Nick meant is that this element are use to format the HTML code or the HTML structure by itself and not the way the page displays.

However you should know there are certain elements in HTML that alter the way the page looks but these are usually bad practice and therefore you should use CSS.