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
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"]
.
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.
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"
}