I'm using REM units for my project. I would like to use a uniform type of units for all the project. I'm working with a group of developers and I'm trying to find a reason why I would have to apply REM units in all the CSS rules, but sometimes I maybe find it excessive or completely useless.
I would like to know if the following is necessary, benefits or disadvantages:
input{
border-radius: 0.5rem;
display: block;
margin: 0 0 2rem 0;
min-width: 12rem;
height: 4rem;
padding: 0 2rem;
width: 100%;
}
In this example you can see the border-radius is 5px as the HTML has applied font-size: 62.5%
to have an easier method applying the REM units.
The border-radius property can accept any valid CSS length unit. That means everything from px , rem , em , ch , vh , vw , and a whole bunch more are fair play. You may specify the value of border-radius in percentages.
This issue proposes that small values, ranging from 1px to 4px , should be set in px rather than rem as they are most commonly used for things like borders, which should render consistently regardless of any user adjustments to browser font size.
Use EM where you have to make more scaling than the root font size. And use REM where you need value according to the root there you can use REM units. This can help with many factors and reduce your code in responsive.
Rem and pixel (px) are two units of measurement frequently used in CSS and HTML to define font size, margin or image size for example. However, the two units have a big difference in terms of web accessibility, because a pixel is not responsive and that's why it'sbetter to use REM.
There is no technical reason not to use the rem
unit for border-radius
. Neither is never any compelling reason to use the rem
unit, for it or otherwise. Using rem
is merely something chosen for convenience, as it may help to avoid computing multipliers for the em
unit, at the cost of reduced cross-browser functionality.
It is generally safest to use the same unit for different dimensions, and this applies to border-radius
, too, when the height and width of the element have been set in rem
units. The reason is that this ensures that the shape is preserved if the font size of the root element is changed. If you set the border-radius
e.g. in px
units and width and height in rem
units and the font size of the root element is then set to, say, 32pt, the element box becomes rather large but the border curvature remains small.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With