Bothersome question for learning newbie!
I am working on my AS in IT and am currently taking introduction to web development. We just started classes and finished our first unit. We are at the moment learning HTML5. For our first unit we created a basic setup of HTML for our homepage. According to the reading and assignment my code was to look like this:
Now here is the part that is bothering me. I got a 100 on the assignment but the professor told me I needed to take out the second line of <html>. I like to understand things and want to understand why this would need to be taken out. In my understanding the DOCTYPE gives the instruction and the html is the root element.
So here are my questions:
Should the <html> remain on that second line?
If so, am I right in the explanation?
If not, can you tell me why?
What is the affect of having the line vs. not having the line?
Thank you all!
Hmm. I was also of the same belief. So I took a valid HTML5 page and removed the <html> tag. Lo and behold it validated! Apparently that's not a "required" tag anymore. However, good practice suggests keeping it, at least in my mind. For example I have the following in one of my stylesheets:
If <html> isn't there that would be ignored by a web browser.
Hopefully someone smarter than me will come along and give a better answer!
I don't know how you are learning HTML 5 seeing how it doesn't even exist yet but in all existing forms of HTML the HTML start and end tags are optional even though the element itself is required. That means that if you omit the tags, the browser is supposed to act as if there were there. XHTML is different, there are no optional tags.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread