Read the statement by Michael Teeuw here.
Is there a way . . .
-
@strawberry-3-141 Just found this, bless you. Should be in the magic mirror documentation.
-
@strawberry-3-141 said in Is there a way . . .:
@Mykle1 put that in custom.css
body { margin: 20px; height: calc(100% - 40px); width: calc(100% - 40px); }
Might I suggest a small change… 100% can be interpreted by the browser in unexpected ways under certain circumstances. Sometimes when you specify 100% for height, the browser interprets this to mean 100% of the width. This is a safer way to do it:
body { margin: 20px; height: calc(100vh - 40px); width: calc(100vw - 40px); }
vh
stands for Viewport Height, similarlyvw
stands for Viewport Width. Viewport width and height refer to the browser window’s interior size, or in the case of an iFrame, the iFrame’s interior size – essentially the space in which the HTML DOM is visible. A value of1vw
is equal to 1% of the viewport’s width,33vh
is equal to 33% of the viewport’s height, etc.vw
andvh
are especially useful when you want to scale elements relative to the available screen space. -
dang. For some reason, that brings it even tighter to the edges than %. Weird.
I highly recommend the following for use on the official 7" touchscreen display. Gets you the maximum screen usage.
(I have a mini-display magic mirror for work.) :)
body {
margin: 0px;
height: calc(100vh - 10px);
width: calc(100vw - 5px);
} -
@bkeyport said in Is there a way . . .:
dang. For some reason, that brings it even tighter to the edges than %. Weird.
I highly recommend the following for use on the official 7" touchscreen display. Gets you the maximum screen usage.
(I have a mini-display magic mirror for work.) :)
body {
margin: 0px;
height: calc(100vh - 10px);
width: calc(100vw - 5px);
}If your
margin
is 0px, there’s no need to subtract anything from the height and width - they could just be100vh
and100vw
respectively. -
:root { --body-margin : 20px; } body { margin: var(--body-margin); width: calc(100vw - var(--body-margin) * 2); height: calc(100vh - var(--body-margin) * 2); }
-
@michael5r Actually, if I don’t subtract, the margins run clear off the right side and bottom of the screen, using the official 7" touchscreen, those subtractions bring it back to 100%
-
@sean Can you explain your body code a bit? I’m not quite following it.
-
@bkeyport
In modern CSS, you can usevariables
. If you are using values referenced frequently or dependently, you can set that value as variables.
In prior example,--body-margin
is defined. Now you can use it instead static fixed value20px
. So when you have to change that value, just modify--body-margin
once. -
This is the part that’s getting me…
width: calc(100vh - var(–body-margin) * 2);
height: calc(100vw - var(–body-margin) * 2);If I’m reading this correctly - it’s taking the calculation of 100% of the viewpoint(direction) - the margin defined in the varible multiplied by 2?
100% of the viewport height minus 40 pixels in your example?
-
@bkeyport
Yes. you are right.
Just one point, user-defined property should be start with--
not-