- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I have one issue which is spinning my head right now. I got along with em’s more or less well so far but here i ran into a nasty one.
I made a simplified markup example. I have the <a>
inside the <h2>
http://codepen.io/thehung1724/pen/KwgKKp
Now I want to put <a>
tag inside the <h2>
but it will too big because em units are relative to their parent. Is there way to fix it? Thank everyone.
You could do this:
http://codepen.io/drainpip/pen/jEMONE
But me personally I don’t mess with base-level elements and keep them at 1em always. Base-level elements like, p
, li
, a
, etc…
Hi,
Thank you, now I can fix my issue by adding class to <h2>
:D
The obvious solution to this problem is to use rems instead of ems. Rems are based on the HTML element instead of the parent, so they don’t compound. Browser support isn’t perfect but there’s a good polyfill: https://github.com/chuckcarpenter/REM-unit-polyfill
Hi,
Ems also better expect cascading :)