mdgriffith / elm-ui

What if you never had to write CSS again?
https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/
BSD 3-Clause "New" or "Revised" License
1.34k stars 110 forks source link

Improve handling of byCapital font sizing #329

Open jneubrand opened 2 years ago

jneubrand commented 2 years ago
jneubrand commented 2 years ago

By the way, those magic 0.25em numbers could be removed and get us to this:

let
    topVal =
        offset

    bottomVal =
        (1 - offset) - height

    margin =
        String.fromFloat (negate topVal)
            ++ "em "
            ++ (String.fromInt spacingX ++ "0px ")
            ++ String.fromFloat (negate bottomVal)
            ++ "em"
in
Attr.style "margin"
    margin
    :: Attr.style "padding" "0 calc((1/32) * 1em) 0 0px"
    :: Attr.style "overflow" "visible"
    :: attrs

—note the overflow: visible. This way, the hitbox isn't larger than necessary :)