Reputation: 1436
Simple question, probably really obvious but, I made a circular div that will be a floating action button. I want it to be the same size no matter the screen size or resolution. For example, if it's a half inch wide on a smartphone I want it to also be a half inch wide on an iMac. How can I achieve this?
.fab {
width: 58px;
height: 58px;
position: relative;
border-radius: 50%;
background: #F44336;
}
<div class="fab"></div>
Upvotes: 1
Views: 2927
Reputation: 2329
there are 6 different units in which you can give width height to a element.
cm ="centimeters"
mm="millimeters"
in="inches"
px="pixels"
pt="points"
pc="picas"
here top three cm,mm and in are the units who dose not rely screen resolution etc. use one of these three units instead of px
Upvotes: 1