1

I have created a CSS variable

--border-color: #b8b8c4;

Trying to add opacity to the border

border-color: 1px solid rgba(var(--border-color), 0.5);

I created a CSS variable and tried to add opacity to it as shown in one StackOverflow solution. But it is not working.

Some solution, please.

3
  • 6
    you're using hex color but putting it inside rgba...try setting the color in rgba format first Commented Nov 21, 2022 at 7:33
  • RGB for your hex code is rgb(184,184,196). Commented Nov 21, 2022 at 7:46
  • Does this answer your question? Can you set a border opacity in CSS? Commented Nov 21, 2022 at 8:50

1 Answer 1

2
--border-color: 184, 184, 196;
border-color: 1px solid rgba(var(--border-color), 0.5);
Sign up to request clarification or add additional context in comments.

Comments