How To Fix Css Issue In Safari

When it comes to web development, cross-browser compatibility is an important aspect to consider. Every browser has its quirks, and Safari is no exception. So, if you find that your CSS isn’t displaying as expected in Safari, don’t worry – you’re not alone. In this blog post, we’ll discuss some of the most common CSS issues in Safari and provide solutions for each. By the end of this article, you should have a better understanding of how to fix these issues and ensure a seamless browsing experience for your users.

1. Vendor Prefixes

One common issue in Safari is the need for vendor prefixes. These prefixes are necessary for some CSS properties to ensure proper rendering and functionality in Safari. To resolve this issue, you can manually add the required vendor prefixes or use a tool like Autoprefixer to automate the process. Here’s an example of using vendor prefixes for the CSS property transform:

    .example {
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);

2. Flexbox Issues

Safari has been known to struggle with certain aspects of the Flexbox layout. One common problem is flex items not respecting the specified flex-basis value. To fix this, you can use the max-width property in conjunction with flex-basis as shown below:

    .flex-item {
        flex: 1 1 100px;
        max-width: 100px;

3. z-index Issues

Safari sometimes has issues with z-index stacking. A simple workaround for this problem is to apply a transform property to the element with a z-index, like so:

    .element {
        z-index: 10;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);

4. Sticky Positioning

Safari has limited support for the position: sticky; property. To ensure proper functionality, you can provide a fallback with JavaScript or use a polyfill like Stickyfill.

5. Input Element Sizing

Some form elements, like input[type=”search”] and select, have different default styles in Safari. To fix these inconsistencies, you can apply a custom style for Safari using the ::-webkit-search-decoration or ::-webkit-appearance selectors:

    input[type="search"]::-webkit-search-cancel-button {
        -webkit-appearance: none;

    select {
        -webkit-appearance: none;


While Safari can present some unique challenges for web developers, these issues can often be resolved with a few simple adjustments to your CSS. By applying the tips and techniques outlined in this blog post, you’ll be well on your way to ensuring a consistent and enjoyable browsing experience across all browsers, including Safari.