HTML - What is the tag doing?

后端 未结 3 1948
[愿得一人]
[愿得一人] 2020-12-17 23:19

I\'ve been playing with getting a HTML document to display in A4 size and using the code in this codepen works perfectly:

https://codepen.io/rafaelcastrocouto/pen/LF

相关标签:
3条回答
  • 2020-12-17 23:39

    I do not believe that <page> is an actual HTML element.

    When the browser sees this, it probably thinks it is getting old and missing out on new inventions that didn't exist when the browser was released.

    In that case it is treated like a <div>, and CSS rules still apply.

    But really it's best to stick to elements that really exist, instead of pretending they will some day, because in the future the implementations of newly created tags could be different than you expect.

    It would have been better to be written as <div class="page" data-size="A4"> with the CSS looking for div.page and div.page[data-size="A4"].

    0 讨论(0)
  • 2020-12-17 23:42

    It isn't HTML. This just takes advantage of the fact that, in order to facilitate future expansions to the language, browsers allow unknown elements to be targeted with CSS and JS.

    0 讨论(0)
  • 2020-12-17 23:54

    You can read about HTML5 tags HERE

    If you want use HTML5 you should replace <page></page> with <div> or <section>. Page tag doesnt exist!

    with it you can style your HTML with

    section { "your style" } section[size="A4"] { "your style" }

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