CSS opacity not working in iOS

I was having a problem where adding a basic css opacity on an element wouldn’t work when viewing in iOS. Looked fine on desktop.

I didn’t come across a specific solution to my problem, but someone else had a similar thing when using opacity with transitions.

The solution

Try adding visibility: visible to the element.

.element {
    background-color: red;
    opacity: 0.6;
    visibility: visible;
}

One comment

Add your comment

Your email address will not be published. Required fields are marked *