With Photoshop, I can put two different border to an element with two different color. And with that, I can make many dynamic shade-effect with my elements. Even with Photoshop effects, I can manage that with Drop Shadow and Inner Shadow.
On the Web Design concern, if I have design like the image below, how can I achieve that with CSS? Is it really possible?
NOTE: I'm giving two borders to the white element: the outer border is white, and the inner border is greyish. Together, they create a dynamic look so that it feels like an inset element, and the white element is pillow embossed. So thing is a bit:
div.white{
border: 2px solid white;
border: 1px solid grey;
}
But you know it's a double declaration, and is invalid. So how can I manage such thing in CSS?
And if I put border-style: double
then you know I can't pass two different color for the singe double
border.
div.white{
border: double white grey;
}
Additionally, I'm familiar with LESS CSS Preprocessor. So if such a thing is possible using CSS Preprocessor, please let me know.
Alternatively, you can use pseudo-elements to do so :) the advantage of the pseudo-element solution is that you can use it to space the inner border at an arbitrary distance away from the actual border, and the background will show through that space. The markup:
If you want borders that are consecutive to each other (no space between them), you can use multiple
box-shadow
declarations (separated by commas) to do so:I use outline a css 2 property that simply works. Check this out, is simple and even easy to animate:
Try below structure for applying two color border,
you can add infinite borders using box-shadow using css3 suppose you want to apply multiple borders on one div then code is like:
Maybe use outline property
https://jsfiddle.net/Ivan5646/5eunf13f/
You can use outline with outline offset