I'm using page media to define the home page of the web page, but it can't be dynamically adjusted, it can only be adjusted before each rendering, which is very inconvenient
here is the css code:
.test-matter {
page: matter;
}
@page matter{
margin-top: 20mm;
margin-right: 15mm;
margin-bottom: 20mm;
margin-left: 15mm;
}
But it only seems to apply the default page media settings , each side is margin 25mm
You can use
JavaScript
for making this easier. If you use theonresize="myFunction()"
your function will be called every time you change window size.Just add the following:JavScript
HTML
You can use css in the function, to dynamically change it.