Can I have a div tag inside of the head element in a HTML document?

后端 未结 1 1887
小鲜肉
小鲜肉 2021-01-16 07:25

Just want to know if it\'s possible to have a div tag inside the head element?

相关标签:
1条回答
  • 2021-01-16 08:08

    No, <div> is not a valid tag to be inside of the <head> tag, since the <head> tag is only meant to be for metadata (such as title and page description), scripts, styles, and other stuff which isn't meant to be displayed. Although putting it in the <head> works, it's horrible to do so, and you shouldn't put it there (and the specification says that doing that is not valid HTML. Thanks @t.niese); it's invalid HTML

    Also, there is no difference between using " or ' for attribute values (such as id in your case), it's just what you prefer. And yes, using ' is completely valid. I like doing that, since I don't have to hold shift, but it's completely up to you.

    0 讨论(0)
提交回复
热议问题