Fixing the background ‘bleed’

I recently came up against an issue in Safari where the background colour of an element seemed to ‘bleed’ through the edge of the corners when applying both borders and a border-radius (see the image above). After seeing David Cole tweet about the same issue I resolved to find a solution, and it came in the form of the -webkit-background-clip property.

-webkit-background-clip: padding-box;

It’s important to note that if you are using the shorthand notation to specify your other background properties then this should be added after those. It seems that the shorthand notation implies a default clip value which will override one that’s previously set. Your mileage may vary, but it worked a treat for me. Read more about the available values for the property here.

Update: This post has been generously translated into Bulgarian by Albert Ward.

531 notes

Show

  1. kataskeuh-istoselidwn reblogged this from sneak
  2. margo-cosmetics reblogged this from sneak
  3. tigari--electronice reblogged this from sneak
  4. tigari-eletronice reblogged this from sneak
  5. kataskeuh-istoselidon reblogged this from sneak
  6. travelsim reblogged this from sneak
  7. prowthish-istoselidon reblogged this from sneak
  8. escortei reblogged this from sneak
  9. 1article-mania reblogged this from sneak
  10. webmadrid reblogged this from sneak
  11. cheap-papers reblogged this from fabbrikk
  12. blinds-and-curtains reblogged this from sneak
  13. olegpro reblogged this from sneak
  14. cheap-papers reblogged this from sneak
  15. cheap-papers reblogged this from jonathanlane
  16. cheap-papers reblogged this from webkitbits
  17. the-topten reblogged this from sneak
  18. panouriradiante reblogged this from owltastic
  19. uebersetzer-probst reblogged this from webkitbits
  20. paginas-web-uruguay reblogged this from sneak
  21. nhmortgagebroker reblogged this from sneak
  22. astro2k reblogged this from sneak
  23. weddingphotographersdublin reblogged this from sneak
  24. htmlheroblog reblogged this from sneak and added:
    Для тех, кому лень читать, скажу, что нужно использовать: background-clip:
  25. romani-in-uk reblogged this from sneak