position: fixed;
: la referencia es el viewport.
position: absolute;
: la referencia es el elemento que lo contiene + su
padding, cuya
position sea distinta de static.
position: static;
| position: relative;
: la referencia es el
elemento padre que sea de bloque, sin contar
el
padding.
Body = 1em (16px)
Hijo = 1.3em (16px x 1.3 = 20.8px)
Nieto = 1.3em (20.8px x 1.3 = 27.04px)
html
(navegador).
Windows, Viewport Units & Scrollbars Hiding Scrollbars on Windows machines After adding vw , you probably saw that the scrollbars appeared in case you are working on Windows. This happens as using vw on Windows does not include the scrollbars - vw: 100 is equal to 100% of the viewport width + the scrollbars. On the Mac this is not an issue, but when using Windows it is as the scrollbars are displayed by default. In case you don't want to display these scrollbars, you can use one of these solutions: - Use width: 100% instead of vw: 100 - Add overflow-x: hidden; to the body selector in the shared.css file to hide the horizontal scrollbar (or overflow-y: hidden to hide the vertical scrollbar) Alternatively you could also use the ::-webkit-scrollbar pseudo element. Simply add the following code to the shared.css file: body: :-webkit-scrollbar { width: 0 } To make sure this works correctly on different browsers, you have to add additional code to it. This blog post nicely summarizes all the code needed right here . Make sure to follow these approaches in case you don't want to display the scrollbars on Windows machines.
height: 100%;
a un elemento:Es necesario aplicárselo también a sus padres (incluso body
y html
)
para
que lo reciba.