home.social

#cssmaths — Public Fediverse posts

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

  1. #tinyCSStip

    Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.

    It just solved my own tiny misalignment problem that was driving me batty. 🦇

    #CSS #cssMaths #code #coding #frontend #web #dev #webDevelopment #webDev

  2. Missed this, made on the 1st of Jan on @codepen:

    ✨ Sliding border glow on hover for beveled cards, heavily commented codepen.io/thebabydino/pen/Eay

    Trivial if we have `corner-shape` support & even simpler with `border-area`. But here it's cross-browser.

    Detailed explanation of the Maths behind on Ko-fi/ Patreon. This way, you get to both become smarter and support my work so I can continue coding.

    #CSS #Maths #cssMaths #cssGradient #cssMask #code #coding #frontend #web #dev #webDev #webDevelopment

  3. #cssChallenge2025
    How would you do this? A gradient tinted image, the gradient tint gradually disappearing from left to right on hover, then coming back from left to right on exit.

    ✨ single `img` elem (so no pseudos)
    ✳️ cross-browser
    🚫 no JS
    🚫 no SVG filter

    #CSS #cssGradient #cssVariables #code #web #dev #webDevelopment #webDev #frontend #coding #cssMaths

  4. There are n equally sized items arranged in half a circle on the left, from top to bottom, with the same gap g in between. How do you do it? Cross-browser, same #CSS (≤20 declarations) should work when changing their number/ gap.

    Try to code it yourself before checking my solution reddit.com/r/Frontend/comments

    Live on @codepen: codepen.io/thebabydino/pen/ZYQ

    #Maths #geometry #trigonometry #code #cssMaths #coding #frontend #cssLayout #webDev #webDevelopment #web #dev #cssGrid #cssTransform #cssVariables

  5. For all Ko-fi/ Patreon supporters...

    First off, thank you for supporting my work and helping me stay afloat!

    And second, something new dropped today...

    ko-fi.com/post/Blobby-reveal-o

    patreon.com/posts/blobby-revea

    PS: hope you like SVG filters because there's more cooking/ coming soon. Next thing *very* soon because it's functional (even if not pretty yet) & dying to share it.

    #SVG #filter #CSS #svgFilter #coding #code #frontend #cssGradient #web #dev #webDevelopment #cssVariables #webDev #cssMaths

  6. I made a little thing on @codepen :pure #CSS #scroll controlled swipe transition codepen.io/thebabydino/pen/azO

    Note how the swipe always clockwise, regardless of scroll direction and how the text fades in after the swipe in.

    Inspiration x.com/avanderpotte/status/1923
    (via @codrops motion highlights roundup)

    cc @bramus

    #scrollAnimation #code #coding #frontend #cssGradient #cssMask #conicGradient #cssMaths #maths #scrollEffect #cssGrid #web #dev #webDev #webDevelopment

  7. A fun little scroll-driven thing I made. The text is white over the image, but the image isn't static, it rotates on scroll. 😼

    Here's a detailed explanation of the how behind reddit.com/r/css/comments/1jyu

    Live on @codepen codepen.io/thebabydino/pen/dPP

    Also uses container queries, CSS trigonometric functions.

    #CSS #scroll #cssAnimation #code #web #scrollAnimation #frontend #coding #dev #cssVariables #cssTransform #webDev #webDevelopment #cssMaths #trigonometry

  8. #tinyCSStip Simplifying animations with variables and mathematical functions.

    Same result, just not writing almost the same `text-shadow` a bunch of times in a bunch of keyframes.

    Live test on @codepen codepen.io/thebabydino/pen/MYW

    #CSS #Maths #code #coding #frontend #web #dev #webDev #webDevelopment
    #cssMaths #trigonometry

  9. Saw youtube.com/watch?v=An3QMWg3m1c linked last evening & gave the challenge a quick go myself.

    My approach was a mostly #CSS one, with minimal HTML (no extra wrappers) and JS (used only to update top item index, ~200 bytes minified).

    While it was working, it wasn't pretty, so today I polished the demo & heavily commented the CSS - check it out on @codepen: codepen.io/thebabydino/pen/jEN

    #cssGrid #cssSubgrid #cssMaths #Maths #code #coding #frontend #web #dev #webDev #webDevelopment #cssLayout #cssVariables

  10. #tinyCSStip/ fun fact: same aspect ratio is also what we need for a regular hexagon because that can made up of only equilateral triangles!

    We just need more points for the clip-path (6 for a hexagon vs. 3 for a triangle).

    #CSS #cssMaths #trigonometry #maths #mathematics #frontend #code #coding
    #web #dev #webDevelopment #webDev #hexagon

  11. #tinyCSStip Want to create a triangle with all edges equal in 4 simple #CSS declarations?

    Such a triangle also has all vertex angles equal = (sum of angles in a triangle)/3 = 180°/3 = 60°

    👉 en.wikipedia.org/wiki/Sum_of_a

    Knowing its edge length a, its height is a·sin(60°).

    Aspect ratio of the box
    a/(a·sin(60°)) = 1/sin(60°)

    #cssMaths #Maths #Mahematics #code #trigonometry #triangle #coding #webDev #frontend #web #webDevelopment #dev

  12. Also on the topic of circle sectors/ pie slices 🥧 - I've updated an old SO answer of mine stackoverflow.com/a/14185845/1

    This goes through the simplest code possible in 2024 for a few cases (equal slices or not, interactive/ with content or not).

    #CSS #cssGradient #Sass #conicGradient #clipPath #cssMaths #Maths #geometry #trigonometry #code #coding #frontend #web #dev #webDev #webDevelopment

  13. As someone hearted ❤️ a 2015 demo of mine, I decided that since #CSS got better (and hopefully I did too), I should go for a quick 2024 remake.

    Here it is on @codepen
    codepen.io/thebabydino/pen/wKo

    It's mindblowing 🤯 how much I could reduce the (esp. compiled) code - check it out!

    HTML by 73%!
    CSS by 70%!

    I repeat: I shaved off at least 70% from each! ‼️

    #Sass #SCSS #Haml #Pug #preprocessor #cssVariables #HTML #cssGrid #cssLayout #cssMaths #code #coding #frontend #web #dev #webDev #webDevelopment