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");
<!-- main_leaderboard, all: [728,90][970,90][320,50][468,60] --> Bootstrap Pagination ❮ Previous Next ❯ Basic Pagination If you have a web site with lots of pages, you may wish to add some sort of pagination to each page. A basic pagination in Bootstrap looks like this: 1 2 3 4 5 To create a basic pagination, add the .pagination class to an <ul> element: Example <ul class="pagination"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> </ul> Try it Yourself » Active State The active state shows what is the current page: 1 2 3 4 5 Add class .active to let the user know which page he/she is on: Example <ul cla...
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1422003450156-2'); }); Bootstrap JS Affix ❮ Previous Next ❯ JS Affix (affix.js) The Affix plugin allows an element to become affixed (locked) to an area on the page. This is often used with navigation menus or social icon buttons, to make them "stick" at a specific area while scrolling up and down the page. The plugin toggles this behavior on and off (changes the value of CSS position from static to fixed), depending on scroll position. The affix plugin toggles between three classes: .affix , .affix-top , and .affix-bottom . Each class represents a particular state. You must add CSS properties to handle the actual positions, with the exception of position:fixed on the .affix class. For more information, read our Bootstrap Affix Tutorial. Tip: The Affix plugin is often used together with the Scrollspy plugin. Via data-* Attributes Add data-spy="aff...
<!-- main_leaderboard, all: [728,90][970,90][320,50][468,60] --> SVG in HTML ❮ Previous Next ❯ In HTML5, you can embed SVG elements directly into your HTML pages. Embed SVG Directly Into HTML Pages Here is an example of a simple SVG graphic: Sorry, your browser does not support inline SVG. and here is the HTML code: Example <!DOCTYPE html> <html> <body> <h1>My first SVG</h1> <svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /> </svg> </body> </html> Try it Yourself » SVG Code explanation: An SVG image begins with an <svg> element The width and height attributes of the <svg> element define the width and height of the SVG image The <circle> element is used to draw a circle The cx and cy attributes define the x and y co...