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


Why to wrap an attribute value in quotation marks ?

Hi, I wanna know why we wrap an attribute value in quotation marks ? and we don't do the same when we are defining a value in CSS ???

Please help my curious mind :D

Stone Preston
Stone Preston
42,016 Points

can you post an example of what you are describing?

Elaborate on what you're asking, like Stone Preston said. My first reaction is that we don't do that. Maybe if you give me more context I can help.

Hi, Thanks allot Stone Preston and Xander Taylor for replying to my question :) Actually I miswrote my question, now I have edited it.

Here are code examples =

<input type="text" name="fname">

In HTML we use quotation marks to wrap the value while in css we don't !!!

background-color: #fff;

I wanna know why ?

2 Answers

Andrew Shook
Andrew Shook
31,709 Points

The simplest answer to your question, Percy, is because they are two different languages designed two do different things. Also, these languages were developed by two different designers (read programmers), see HTML here and CSS here. What the languages do also probably plays a role in these choices. In some aspects your question is like asking why a fork is shaped like a fork or why cars work they way they do, and the answer is because that's just the way they were made. Without talking to the people who designed the language you'll probably never get answer that is 100% accurate.

Thanks allot for your nice and a little humiliating answer :p I have used such quotations in other programming languages like python where it referred to strings, So I was just guessing that it is related to string data :)

Thanks allot Andrew :)

Andrew Shook
Andrew Shook
31,709 Points

Percy, I'm sorry if you felt humiliated, that was not what I intending. I didn't think that your question was stupid, I was just pointing out that you were not likely to find a satisfying answer without being able to talk to one of the original developers. Also, I did answer this before my first cup of coffee, so I apologized if I came across as humiliating.

No worries Andrew, I was just kidding :) You really helped me allot :) Thanks allot :)