Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control the two colors of an inset border?

I'm trying to see if there's a way to change the two colors of the inset border in CSS

As you know, the inset style creates a border on an element that creates the illusion that that it has an embedded border. It achieves this by making the bottom and right border the color you selected, and changes the color of the top and left border a slightly darker shade.

Does anyone know of a way where you can control how dark, or maybe even different color the alternate shade would be?

#myElement{
    border: inset 1px white;
}

Thanks.

like image 418
Philll_t Avatar asked Jul 12 '13 02:07

Philll_t


People also ask

How do you add two colors to a border?

If you mean using two colours in the same border. Use e.g. border-right: 1px white solid; border-left: 1px black solid; border-top: 1px black solid; border-bottom: 1px white solid; there are special border-styles for this as well ( ridge , outset and inset ) but they tend to vary across browsers in my experience.

What is an inset border?

inset. Displays a border that makes the element appear embedded. It is the opposite of outset .


1 Answers

I don't think you can control it the way I mentioned, but for sure you can control the individual color of each border:

#myElement{
  border-style: solid;
  border-width: 1px;
  border-top-color: black;
  border-left-color: black;
  border-right-color: white;
  border-bottom-color: white;
}
like image 166
Philll_t Avatar answered Sep 23 '22 16:09

Philll_t