I want to put an example I have the following code. Without any css available
<body>
<div id="main-container">
<main>
<h1 id="titulo">Database</h1>
<input type="search" name="" id="input_search">
</main>
</div>
</body>
Let's say I want to make it about 500px tall. Well, the question is, how should I do the calculations, to go from 500 px to em, is that I have seen that when a web page is created, the default font size is 16px, what I should do is the calculation from those 16px to receive how much em would I need? Is that if so, I do not understand why it is calculated by the source.
This concept must be clarified if the unit of measure
em
is relative to the size of the font or the one inherited by the font:to have a space of
500px
: you must have the declared source set to a number X that multiplied byem
you gives500px
:Reference Documentation :
Examples:
and is used to make the web
responsive
if you set the one:It's good because you can have something like this:
In short, you can make the design thinking of 500px but everything will depend on the size of the font that the user chooses; if the user sets the browser screen to 50% the box will be 250px; because it is relative to the font size.