Posted On May 7, 2019

CSS: Units of Measurement

kimconnect 0 comments
blog.KimConnect.com >> Codes >> CSS: Units of Measurement
Common Values of Measurement

px :pixel
in :inches
mm :millimeters
em :relative to nearest parent element’s set value (font-size, div, etc)
rem :Root EM, only relative to the root (html) set values
!important :over-ride parent’s presets and enforce preceding values

Example CSS for Illustration
<style>
.sometext {
margin-bottom: -50px;
text-align: center;
font-size: 2in!important;
}

.box {
border-style: dotted;
border-color: red;
border-width: 5px;
text-align: center;
}

.parent-box {
background-color: yellow;
}

.box1 {
background-color: grey;
margin: 20px 10px 20px 10px;
padding: 1.5em
}

.box2 {
background-color: white;
margin: 20px 10px 20px 10px;
padding: 1.5rem
}
</style>
<h5 class="sometext">Some Text</h5>

<div class="box parent-box">
<h5 class="box box1">padding</h5>
<h5 class="box box2">padding</h5>
</div>
Output

Some Text
padding
padding
padding

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Perform DISM Restore Health on Remote Servers

# This script will use a Windows ISO image to Repair Remote Computers$isoPath="\\FILESHERVER007\F$\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO"$remoteComputers="TESTKOMPUTER","TESTKOMPUTER2"function restoreServerHealth($iso){ #…

In Search of an Appointment Calendaring System

Group I: Wordpress Plug-in Since websites are often built with Content Management Systems such as…

PowerShell: Find Windows RDS Roles and Their Licensing Servers

# Get TS Licensing Servers (Enterprise or AD Registered) $termLicenseServers=Get-ADGroupMember -Identity "Terminal Server License Servers"…