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

Confused about what symbol I should use and when

I'm trying to implement what I've learned about HTML and CSS by creating my own workspace and what's been really confusing to me is what symbol I need to use and when. For example, I was trying to link my external stylesheet to my html page and I typed: "<link href:"style.css" rel:"stylesheet"> but nothing was happening until I notice after a while that I inserted a colon sign (:) instead of an equal sign(=). <link href="style.css" rel="stylesheet">

So I guess my question is: When should I be using the equal sign, colon and semicolon, parentheses, or single parenthesis (')?

Complete newbie here at coding so thanks for any answers!

2 Answers

Steven Parker
Steven Parker
243,318 Points

It's best to consult the documentation when you are unsure.

But some general rules are:

  • HTML attributes are separated from values by equal sign (=).
  • CSS properties are separated from values by colon (:).
  • CSS property/value pairs are separated by semicolon (;)
  • Strings can be enclosed in either double quotes (") or single quotes (AKA apostrophe — '), but be sure to use the same kind to open and close.

Helps a lot thanks Steven