There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
Double quote or single quote which one is best practice? I saw that top websites used the double quote for linking their stylesheet in the <link> tag. Codecademy also used double quotation. So why a single quote for the lesson?
Single and double quotation marks can be used interchangeably in HTML to access files, directories or external hyperlinks. W3C protocols require using Unicode in place of certain special characters for URLs, and having these two on that “do not use” list prevents errors caused by cutoff hyperlinks.
You’ll also find similar syntax rules in JavaScript regarding functions, objects and text strings, because JS and CSS are integral part of HTML-based programming. Introducing you to using single quotes is a means of developing good coding habits through consistency and convenience.
As long as everything works the way it should, how you do it is based on what works best for you.
The lesson asks us to set the link href equal to style.css rather than ./style.css. They both apply the stylesheet. Why is it that we don’t need the relative path in this case?
Hi, if I was creating a website, it would depend on me where I place an HTML file(s) and CSS file(s). The CSS file is often placed in the ‘css’ directory inside of the directory where is the ‘index.html’ file, so in such cases, the relative path is ‘css/style.css’. But for educational purposes with small projects is the ‘style.css’ file usually just in the same folder as HTML file, so the relative path consists only of the name of the CSS file.
there is an exchange in the comments between users Coomie and teemoh:
Teemoh: So whats the difference between ./abc.htm and just abc.htm ?
Coomie: @Teemoh They’re the same in JS, HTML and CSS. The “./” is a old programing convention that carried over into these newer languages. In other circumstance they could mean different things. eg. if a “path” is set in an OS abc.exe could be a file and ./abc.exe might not.
Dear all , I have a question if we will write link attribute inside body tag then it also works fine then why we write link any external css file or any styling in the head tag?
He is saying that because the double quote and singe quote characters cannot be used in a url, that it is fine to use either of them to surround the url (creating a ‘string’) without causing a need for an ‘escape character’.
…this confused me at first, too.
Escaping quotes that are inside of strings is more commonly taught in programming language courses (such as courses in JavaScript) and does go beyond the traditional scope of a CSS course; things like folder structure, file extensions, and escape characters often go ‘glossed over’ in beginning material and I can’t think of topics where they all might be reliably included comprehensively in the curriculum outside of Bash or Linux educational material. Even many Java courses will often leave out discussions of folder structure and yet still expect students to understand theoretical discussions of ‘package’ structure.
The order in which you place the <title> and <link> elements inside the <head> section of an HTML document does not have a functional impact on your web page. The browser parses the HTML document from top to bottom, and these elements are independent of each other in terms of their functionality.
However, it’s a common practice to place the <title> element first in the <head> section. The title is what appears in the browser tab or window, and having it near the top of the <head> section makes it easy to find and understand the purpose of the page.
the <link> element appears to be a self-closing tag, but in the examples, there is no forward slash placed at the end before the closing >.
It seems the forward slash is not needed (as the code works without a closing tag or the forward slash). I have also tested it with a forward slash at the end of the self-closing <link> tag and the browser still renders everything correctly with this included.
My question is then: is it good/common practice to leave the forward slash out, and if so - why leave it out of the <link> elements, but put it in other self-closing elements such as <img>?