Jump to content

What's wrong with this HTML?

AlTech
Go to solution Solved by HarryNyquist,

There's nothing wrong with that HTML. Something's wrong with the Codeacademy course answer if it thinks that's wrong.

So i'm using codecademy.

 

Before anybody scoffs or has a heart attack -_-, I'm just trying to learn syntax......

 

<!DOCTYPE html>
<html>
	<head>
		<title>A title</title>
	</head>
	<body>
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/f3a16fb6.jpg"/>
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg"/>
	</body>
</html>

So what's wrong with this code? Codecademy tells me there's an error.......

 

This is what it asked me to do on the codecademy course:

Quote
Instructions

Add a second image below the first one. (Make sure it's before the closing <body> tag!)

If you can't think of a good picture, use this ninja:


https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg

Thanks guys.

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, AluminiumTech said:

-snip-

Honestly, I can't seem to see what's wrong with it.

Link to comment
Share on other sites

Link to post
Share on other sites

i cant find anything wrong with that, i even copied it to a file and opened the .html file in my browser and its fine

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, AluminiumTech said:

So i'm using codecademy.

 

Before anybody scoffs or has a heart attack -_-, I'm just trying to learn syntax......

 


<!DOCTYPE html>
<html>
	<head>
		<title>A title</title>
	</head>
	<body>
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/f3a16fb6.jpg"/>
		<img src="https://s3.amazonaws.com/codecademy-blog/assets/ninja_zpsa5dbe37a.jpg"/>
	</body>
</html>

So what's wrong with this code? Codecademy tells me there's an error.......

 

This is what it asked me to do on the codecademy course:

Thanks guys.

Hey dude,

 

Code wise - nothing.

 

Knowing codeacademy it'll be somehting like an indent or something stupid..

 

Have fun - try reloading the webpage and retyping in the code that you were asked to do

Edited by JackHubbleday
add more information

Don't forget to @me / quote me for a reply =]

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Nothing wrong with it. <img> is a self closing tag, used to be <img ...></img> per xhttp standards but in html 5 it's simplified to <img ... /> like many other self closing tags.

 
~ Specs bellow ~
 
 
Windows 10 Pro 64-bit [UEFI]
CPU: Intel i7-5820k Haswell-E @ 4.5-4.7Ghz (1.366-1.431V) | CPU COOLER: Corsair H110 280mm AIO w/ 2x Noctua NF-A14 IPPC-2000 IP67 | RAM: G.Skill Ripjaws 4 32Gb (8x4Gb) DDR4 @ 2666mhz CL15 | MOBO: MSI X99S Gaming 7 ATX | GPU: MSI GTX 1080 Gaming (flashed "X") @ 2138-2151Mhz (locked 1.093V) | PSU: Corsair HX850i 850W 80+ Platinum | SSD's: Samsung Pro 950 256Gb & Samsung Evo 850 500Gb | HDD: WD Black Series 6Tb + 3Tb | AUDIO: Realtek ALC1150 HD Audio | CASE: NZXT Phantom 530 | MONITOR: LG 34UC79G 34" 2560x1080p @144hz & BenQ XL2411Z 24" 1080p @144hz | SPEAKERS: Logitech Z-5450 Digital 5.1 Speaker System | HEADSET: Sennheiser GSP 350 | KEYBOARD: Corsair Strafe MX Cherry Red | MOUSE: Razer Deathadder Chroma | UPS: PowerWalker VI 2000 LCD
 
Mac Pro 2,1 (flashed) OS X 10.11.6 El Capitan 64-bit (NAS, Plex, HTTP Server, Game Servers) [R.I.P]
CPUs: 2x Intel Xeon X5365 @ 3.3Ghz (FSB OC) | RAM: OWC 16Gb (8x2Gb) ECC-FB DDR2 @ 1333mhz | GPU: AMD HD5870 (flashed) | HDDs: WD Black Series 3Tb, 2x WD Black Series 1Tb, WD Blue 2Tb | UPS: Fortron EP1000
 
Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Cela1 said:

You sure removing that forward slash from the end of the image tags won't work?

That's supposed to be there, though, otherwise the code won't comply with W3C standards for the Doctype he is using.

 
~ Specs bellow ~
 
 
Windows 10 Pro 64-bit [UEFI]
CPU: Intel i7-5820k Haswell-E @ 4.5-4.7Ghz (1.366-1.431V) | CPU COOLER: Corsair H110 280mm AIO w/ 2x Noctua NF-A14 IPPC-2000 IP67 | RAM: G.Skill Ripjaws 4 32Gb (8x4Gb) DDR4 @ 2666mhz CL15 | MOBO: MSI X99S Gaming 7 ATX | GPU: MSI GTX 1080 Gaming (flashed "X") @ 2138-2151Mhz (locked 1.093V) | PSU: Corsair HX850i 850W 80+ Platinum | SSD's: Samsung Pro 950 256Gb & Samsung Evo 850 500Gb | HDD: WD Black Series 6Tb + 3Tb | AUDIO: Realtek ALC1150 HD Audio | CASE: NZXT Phantom 530 | MONITOR: LG 34UC79G 34" 2560x1080p @144hz & BenQ XL2411Z 24" 1080p @144hz | SPEAKERS: Logitech Z-5450 Digital 5.1 Speaker System | HEADSET: Sennheiser GSP 350 | KEYBOARD: Corsair Strafe MX Cherry Red | MOUSE: Razer Deathadder Chroma | UPS: PowerWalker VI 2000 LCD
 
Mac Pro 2,1 (flashed) OS X 10.11.6 El Capitan 64-bit (NAS, Plex, HTTP Server, Game Servers) [R.I.P]
CPUs: 2x Intel Xeon X5365 @ 3.3Ghz (FSB OC) | RAM: OWC 16Gb (8x2Gb) ECC-FB DDR2 @ 1333mhz | GPU: AMD HD5870 (flashed) | HDDs: WD Black Series 3Tb, 2x WD Black Series 1Tb, WD Blue 2Tb | UPS: Fortron EP1000
 
Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, SaladFingers said:

That's supposed to be there, though, otherwise the code won't comply with W3C standards for the Doctype he is using.

 

1 minute ago, SaladFingers said:

Nothing wrong with it. <img> is a self closing tag, used to be <img ...></img> per xhttp standards but in html 5 it's simplified to <img ... /> like many other self closing tags.

 

2 minutes ago, Cela1 said:

You sure removing that forward slash from the end of the image tags won't work?

 

3 minutes ago, HarryNyquist said:

There's nothing wrong with that HTML. Something's wrong with the Codeacademy course answer if it thinks that's wrong.

 

4 minutes ago, JackHubbleday said:

Hey dude,

 

Code wise - nothing.

 

Knowing codeacademy it'll be somehting like an indent or something stupid..

 

Have fun - try reloading the webpage and retyping in the code that you were asked to do

 

9 minutes ago, Cela1 said:

*Staring intensifies*

 

Thanks everybody. It was codecademy being stupid :D and not me.

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Tom Smyth said:

Code academy often glitches and does but accept the answer. I suggest you google the answers and you will find a github page with the correct code on. Copying that will usually cause code academy to accept the answer and put you onto the next task.

 

Even correct code is sometimes rejected. 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

To further add to what I said above, it appears I was wrong and "/" is not really required in HTML5. But both syntaxes are correct.

 

https://www.w3.org/TR/html5/syntax.html#void-elements

 

If a tag can't have any elements in it, you can either use the "/" or not and it doesn't take a closing tag at the end (e.g </img>).

 
~ Specs bellow ~
 
 
Windows 10 Pro 64-bit [UEFI]
CPU: Intel i7-5820k Haswell-E @ 4.5-4.7Ghz (1.366-1.431V) | CPU COOLER: Corsair H110 280mm AIO w/ 2x Noctua NF-A14 IPPC-2000 IP67 | RAM: G.Skill Ripjaws 4 32Gb (8x4Gb) DDR4 @ 2666mhz CL15 | MOBO: MSI X99S Gaming 7 ATX | GPU: MSI GTX 1080 Gaming (flashed "X") @ 2138-2151Mhz (locked 1.093V) | PSU: Corsair HX850i 850W 80+ Platinum | SSD's: Samsung Pro 950 256Gb & Samsung Evo 850 500Gb | HDD: WD Black Series 6Tb + 3Tb | AUDIO: Realtek ALC1150 HD Audio | CASE: NZXT Phantom 530 | MONITOR: LG 34UC79G 34" 2560x1080p @144hz & BenQ XL2411Z 24" 1080p @144hz | SPEAKERS: Logitech Z-5450 Digital 5.1 Speaker System | HEADSET: Sennheiser GSP 350 | KEYBOARD: Corsair Strafe MX Cherry Red | MOUSE: Razer Deathadder Chroma | UPS: PowerWalker VI 2000 LCD
 
Mac Pro 2,1 (flashed) OS X 10.11.6 El Capitan 64-bit (NAS, Plex, HTTP Server, Game Servers) [R.I.P]
CPUs: 2x Intel Xeon X5365 @ 3.3Ghz (FSB OC) | RAM: OWC 16Gb (8x2Gb) ECC-FB DDR2 @ 1333mhz | GPU: AMD HD5870 (flashed) | HDDs: WD Black Series 3Tb, 2x WD Black Series 1Tb, WD Blue 2Tb | UPS: Fortron EP1000
 
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×