S
S
sasha_jarvi2019-05-23 15:03:09
css
sasha_jarvi, 2019-05-23 15:03:09

How to fix incorrect gradient rendering in Safari 12.0.3?

I have the following code to set the background for an element:

background-image: linear-gradient(to bottom, #373c46, rgba(255, 255, 255, 0));
background-image: -webkit-linear-gradient(top, #373c46 0%, rgba(255, 255, 255, 0) 100%);

In Chrome, this gradient is displayed correctly:
N6YvX.png
In Safari, on the contrary, it is not:
axixr.png
How to fix the indicated error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Usachov, 2019-05-23
@sasha_jarvi

You need to convert $header-gradto rgba and dance from it. Safari sees any transparent gradient as 0% black (or white? I don't remember). In short, if, for example, we want to make a fading red, then we write like this:

elem {
    background-image: linear-gradient(to bottom, rgba(255, 0, 0, 1), rgba(255, 0, 0, 0));
    /* ниже ваш цвет */
    background-image: linear-gradient(to bottom, rgba(55, 60, 70, 1), rgba(55, 60, 70, 0));
}

V
Valery, 2019-05-23
@Desay

htmlbook.ru/css/-webkit-linear-gradient

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question