The tool below allows you to work out the em sizes from pixels (or vice versa).
Pixel to Em Converter
Set a default pixel size for body (usually 16px)
Then, convert a pixel value to em, based on the default pixel size
Or, convert an em value to pixels, based on the default pixel size
Set a default pixel size:
px
Convert PX to EM: px
Convert EM to PX: em
Result:
Body Font Size
In the table below, select a body font size in pixels (px) to display a complete "px to em and percent" conversion table.
Tip: The default font size is usually 16px.
What is the difference between PX, EM and Percent?
Pixel is a static measurement, while percent and EM are relative measurements. The size of an EM or percent depends on its parent. If the text size of body is 16 pixels, then 150% or 1.5 EM will be 24 pixels (1.5 * 16). Look at CSS Units for more measurement units.
function fillTable(x) { var t = ""; t = t + "
" t = t + "
" t = t + "
px" t = t + "
em" t = t + "
percent" t = t + "" for (i = 5; i < 26; i++) { t = t + "
" + i + "px" t = t + "
" + (i/x).toFixed(4) + "em" t = t + "
" + ((i/x) * 100).toFixed(2) + "%" t = t + "" } t = t + ""; document.getElementById("demo").innerHTML = t; }
fillTable(16);
function wrong() { document.getElementById("myInput2").disabled = true; document.getElementById("myInput2").value = ""; }
function wrong2() { document.getElementById("myInput").disabled = true; document.getElementById("myInput").value = ""; }
function works() { document.getElementById("myInput2").disabled = false; document.getElementById("myInput2").value = ""; }
function works2() { document.getElementById("myInput").disabled = false; document.getElementById("myInput").value = ""; }
function myFunction() { var x = document.getElementById("myInput").value; var z = document.getElementById("myInput2").value; var y = document.getElementById("pix1").value; var res = document.getElementById("result1");
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1422003450156-2'); }); Google Social Icons ❮ Previous Next ❯ Social Icons The table below shows all Google Social icons: Icon Description Example cake cake Try it domain domain Try it group group Try it group_add group_add Try it location_city location_city Try it mood mood Try it mood_bad mood_bad Try it notifications notifications Try it notifications_none notifications_none Try it notifications_off notifications_off Try it notifications_active notifications_active Try it notifications_paused notifications_paused Try it pages pages Try it party_mode party_mode Try it people people Try it people_outline people_outline Try it person person Try it person_add person_add Try it per...
<!-- main_leaderboard, all: [728,90][970,90][320,50][468,60] --> Bootstrap Form Inputs (more) ❮ Previous Next ❯ Static Control If you need to insert plain text next to a form label within a horizontal form, use the .form-control-static class on a <p> element: Email: someone@example.com Example <form class="form-horizontal"> <div class="form-group"> <label class="control-label col-sm-2" for="email">Email:</label> <div class="col-sm-10"> <p class="form-control-static">someone@example.com</p> </div> </div> </form> Try it Yourself » Bootstrap Input Groups The .input-group class is a container to enhance an input by adding an icon, text or a button in front or behind it as a "help text". The .input-group-addon class attaches an icon or help tex...
<!-- main_leaderboard, all: [728,90][970,90][320,50][468,60] --> Bootstrap 4 Grid - Large ❮ Previous Next ❯ Large Grid Example Extra small Small Medium Large Extra Large Class prefix .col- .col-sm- .col-md- .col-lg- .col-xl- Screen width <576px >=576px >=768px >=992px >=1200px In the previous chapter, we presented a grid example with classes for small and medium devices. We used two divs (columns) and we gave them a 25%/75% split on small devices, and a 50%/50% split on medium devices: <div class="col-sm-3 col-md-6">....</div> <div class="col-sm-9 col-md-6">....</div> But on large devices the design may be better as a 33%/66% split. Large devices are defined as having a screen width from 992 pixels to 1199 pixels . For large devices we will use the .col-lg-* classes: <div class="col-sm-3 col-md-6 col-l...