+ 1
Guys can a code of html run with html or head or body tags?
thus on the tutorial the codes are written with out these elements
7 Answers
+ 2
Yes
+ 5
@Sam's "Yes" is a perfect for "omit the optional, leave the details to interpretation".
Good enough for you? Good enough for browsers?
Sure!
Here's some detail anyway. This extends the topic (including links for omittable / optional tags):
https://stackoverflow.com/questions/5641997/is-it-necessary-to-write-head-body-and-html-tags
There are side-effects/bugs to going rogue: Internet Explorer may construct the wrong DOM, Google SEO can not work for you, even SoloLearn inserts the [Script] and [CSS] tabs before the </head> tag.
I've always been fond of thinking those sections help with timing (preload order, what gets separate threads), but when I searched it looks like that's part of a different system.
+ 2
Need the head to contain metadata, stylesheets
Body is the root of the DOM
0
so why we need them?
0
đ got nothing đ
but I think I'll sort it out when I go further
0
Without doctype and html/head tags doesn't pass the W3C validator
0
This is the minimum valid HTML5 document
<!DOCTYPE html>
<html lang="es">
<meta charset="utf-8">
<title>.</title>
</html>