home.social

#csstrick — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #csstrick, aggregated by home.social.

  1. Do you want to add alpha transparency to an opaque hex colour with pure CSS? You can do something like:

    .red-60 {
    color: rgb(from r g b / .6);
    }

    This uses the rgb() function to set 60% opacity to the hex value of red.

    The letters r g b (note the spaces between) are a representation of the red green and blue values of the hex colour. You can think of them as some sort of variable.

  2. #tinyCSStip As I just saw this in a '24 tutorial to make an absolutely positioned pseudo extend `8px` outside its parent in all directions.

    ❌ DON'T 🙀
    width: 100%; height: 100%;
    left: 50%; top: 50%;
    translate: -50% -50%;
    padding: 8px

    ✅ DO 😼 (1 declaration, not 6)
    inset: -8px

    Notes:
    ✨ yes, there are still valid use cases for `position: absolute` pseudos instead of `grid`
    ✨ no, that `padding` wasn't relevant later

    #css #cssTrick #cssTip #code #coding #frontend #web #webDev #dev #webDevelopment

  3. RT Konstantin Denerz
    Create a CSS-based holographic card ✨ using this simple trick from my @CodePen.
    ✅ Mask-Image 🎭
    ✅ Linear-Gradient 🌈
    🔗 codepen.io/konstantindenerz/pe
    Inspiration: twitter.com/drawsgood/status/1
    #css #animation #csstrick #holocard t.co/PY95qOibLJ
    <div class="rsshub-quote">
    Drawsgood: Throwback Tuesday to this holographic card made in @rive_app
    Check it out in the community here: rive.app/community/3515-7963-h t.co/TbYlSjouVs
    </div>
    :sys_twitter: twitter.com/kdenerz/status/164