I want to create the effect of a single horizontal line that is 2 px high. Essentially two single pixel height lines sandwiched together. With each line being different colors.
So the first line (single pixel height) would blue. The second single pixel line directly underneath with no spacing, would be red.
Not sure if this can be achieved using <HR>
or whether it would need to be a div with borders?
Any assistance greatly appreciated.
Haven’t really found anything that works yet.
2
Answers
Assuming this needs to be done at the bottom of a
div
without any additional DOM elements, you can achieve it usingbox-shadow
. (However, the second line in red will not be occupying any space thus you might need to add amargin-bottom
to compensate it)Although it is named as
box-shadow
, when it is used without ablur
/spread
parameter, it looks exactly like a solid line / block.<hr>
is just a normal block element, which means we can style it usingborder-*
properties: