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.

537 notes

Show

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