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

David Collins
PLUS
David Collins
Courses Plus Student 2,598 Points

This is about HTML structure

<!doctype html>
<html lang="en">
< head>
 <meta charset="utf-8">
 <title> My Page </title>
 </head>
 <body>
 </body>
</html>

My first question is If I'm writing code is this where I would start? and Is the above the basic structure for HTML? is this what I would write out for the starting point.

  1. And can I add CSS and JavaScrip to this and more?
  2. Dose the doctype have to be capitalized?
  3. What is the purpose of the exclamation point in the front of <!doctype>?
  4. What is the purpose of the equal? is this to say this is the value of, or is it saying this is its equal? or none of the above
  5. utf-8 dose this mean style or size or both

2 Answers

Emma Willmann
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

Lots of questions! I'll try and answer what I can.

First, your code needs a little bit more. After declaring your doctype, you should open an html tag. Inside of that should be your head tag, which is where you would include your meta tags and title tag. After closing the head tag, you would add a body tag, where what you see on the screen will be placed. Close the body tag, then close the html tag, like this:

<!DOCTYPE html>
<html>
  <head>
     <title>My Page</title>
     <meta charset="utf-8">
  </head>
  <body>
     <h1>Hello World!</h1>
  </body>
</html>
  1. CSS and Javascript - yes, you can definitely add that to this. There is more than one way to do this, which you'll learn in other courses, but you could create your CSS and/or Javascript in another file and link to it in your html file, or you can include that code within the html (generally you would do this separately).
  2. DOCTYPE - I've read things that say yes and others that say no for capitalization. For my part, with writing html5, I've only ever seen it capitalized, so it's probably best practice to do so.
  3. I don't know a lot about the syntax behind the doctype, but here's a link to some info.
  4. Usually in coding, if you are using a single equal sign =, it means you are setting the value. If you are looking to do an equality , like is the value of a equal to the value of b, you would use double equal or sometimes a triple equal like this: a == b or a === b.
  5. utf-8 isn't a style or size, but basically is saying what characters are included. utf-8 is the default in html5 (although its best practice to still include the meta tag setting this). it contains pretty much ever character, compared to say ASCII which only has 128. Here's a little more info.

Hope all that helps.

David Collins
PLUS
David Collins
Courses Plus Student 2,598 Points

Emma Willmann I know I have a lot of questions. Thank you Emma for you're help, so that I can understand this subject better

Emma Willmann
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

Glad I could help. Having questions is a good thing. The more you question, the more you can learn. :-)