The Curious Case of Quotation Marks in HTML/CSS


#1

So, in trying to work on projects at work and possibly having those projects involve websites, I have start the new HTML and CSS lessons. So far I have been really enjoying them and I have learned a lot. However, I have a off hand question about how the Quotation Marks work in HTML/CSS compared to lets say Javascript or Python even. I have found a beautiful thing about HTML/CSS that when i put " its not just one " but "" and when I type in my code it magically ends it for me. However, in other languages if I were to do that same process, only the quotation mark I typed would show up. I was just curious why in HTML it works that way and why can't it be like that in others? lol May be a dumb question but I have really enjoyed these mysterious self closing quotation marks!


#2

this has to do with the editor you are using, the editor can (depending on the editor used/and the settings of the editor) add closing tags, for example if in js you type a { the editor might add a }

depending on the editor, this can be tweaked per language, within the codecademy environment you don't have an option to tweak this


#3

Yeah, I was wondering about that. Since I have only witnessed it in the HTML course I didn't know if it could only happen in HTML or it was with the new codecademy set up for the new HTML course or something else. Yeah I wish it could be tweaked especially since I don't know too many cases that just uses a single ' or ". It has been really nice.


#4

you can set up your own developers environment, for your own coding projects, then you can tweak these things


#5

Yeah I have thought about that just whispers having only been coding for six months of my life gasp I don't really know how to set that up or what I would need to do to do something like that. Plus I work on PCs Macs and Linxs (i think thats how its spelled...) so I wasn't sure if its a "one size fits all" on that or if I would need to create more than one... Yeah basically just got no experience and don't know even where to begin on it lol


#6

A side note: Regardless the editor or IDE you use, it is paramount that we develop good habits in a raw environment (that doesn't do things for us). Fingers learn. Our brain absorbs things in all manner of ways, and syntax training is a manual process when it comes to forming habits.

Look up style guides for pointers on what good habits are at the top of the list. My own favorite:

Always double quote attributes

<img src="#" alt="alternate text" width="240" height="160">