Languages

CSS - control two colors of inset / outset border?

0 points
Asked by:
Saim-Mccullough
718

Is there any way to change the two colors of the inset / outset border in CSS?

I need something that will change the inset style, like:

.myElement{
    border: inset 3px red;
}

or anything that can control how dark the alternate shade is.

1 answer
0 points
Answered by:
Saim-Mccullough
718

I don't think there's a way to control it like you described. However, you can change the individual color of each border:

.myElement {
  border-style: inset;

  border-top-color: lightgreen;
  border-left-color: lightgreen;
  border-right-color: yellowgreen;
  border-bottom-color: yellowgreen;
}

 

Practical example

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>

    .myElement {
      border-width: 10px;
      border-style: inset;

      border-top-color: lightgreen;
      border-left-color: lightgreen;
      border-right-color: yellowgreen;
      border-bottom-color: yellowgreen;
    }

  </style>
</head>
<body>
  <div class="myElement">some text...</div>
</body>
</html>

 

See also

  1. CSS - create multi-color border

References

  1. border - CSS: Cascading Style Sheets | MDN
0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join