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 trialAnastasios Ioannou
3,616 PointsValidation errors: How important is to correct them (especially when the site seems to load and work properly)?
Hello everyone,
I just pasted and tested a piece of code for a mock up website I was building along with the videos of this online module.
While I was testing the site everything seemed to work fine, according to what the tutor was explaining in the videos so far. But the results of the code checking returned me some errors:
For example I had this piece of code:
<link rel="stylesheet" href="C:\Users\Tasos\Desktop\Tasos\Work\Rockboost\Own website\CSS\normalize.css"> for an image.
The error says that the symbol: "\" is not valid and it has to be substituted with "%5C".
Do I have to do this for all the "\" in all lines that contain this symbol? How important this error is? Please note that while I was loading the .html of my mock up website, it was working fine. And If I change all the "\" with "%5C" will everything work fine or I will need to write the code again from the start in order for the file to be able to communicate and retrieve the images from my folders?
Furthermore I got this error:
I got this piece of code fro google for one of its fonts
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i,800|Roboto" rel="stylesheet">
the error I got was that "|" is not a valid character. But this piece of code is what google is giving you when you request a specific set of fonts! How important is this error for example?
The last error is the following:
In this line of code:
<img src="C:\Users\Tasos\Desktop\Tasos\Work\Rockboost\Own website\my Pictures\researchgate.png" class="social-icon">
An "img" element must have an "alt" attribute
IS it it necessary to fit an alt=" " before the class="social-icon" part of my code? How important is this?
Thank you very much for the time and consideration, looking forward for your answers!
Best Tasos Ioannou
2 Answers
Ben Schroeder
22,818 PointsIt's best to take errors like that on a case-by-case basis. In general, HTML validators don't have nearly as much clout as they did in the late 90s / early 2000s, but they can still help you find parts of your markup that could be better optimized.
No modern browser is going to seriously care if your Google Fonts URL has pipes (| symbol) in the URL, and any that would probably have a pretty dubious grasp on web fonts/CSS3 anyway. Considering the fact that Google is providing this code directly, and does so for anybody else who uses Google Fonts too (which is practically everybody), I'd say there's no reason to change it.
The normalize.css path is confusing the validator because one generally doesn't use local file paths in HTML. Paths also use forward-slashes (/), not back-slashes. In this case, I would highly recommend you switch to a relative URL. It's good practice in general, and will also make putting your website online much less of a hassle.
Keeping an alt attribute on all of your images is a good idea. It's considered a "required" attribute, both because it will be rendered in place of the image if the image can't be found/loaded, and because screen readers will use it -- so it's an accessibility issue as well.
Hope this helps!
Anastasios Ioannou
3,616 PointsHello Ben,
thank you very much for your extensive reply. Your answer certainly helps a lot...