For a given div
I would like to only display a border on the left, right, top, or bottom side.
Currently I have the following, which puts a border on all sides:
#testdiv { border: 1px solid; }
What do I need to do in order to have a border only on the left side?
The border-right-color property sets the color of an element's right border. Note: Always declare the border-style or the border-right-style property before the border-right-color property. An element must have a border before you can change the color.
#testdiv { border-left: 1px solid; }
See the MDN documentation on border.
If you want to set 4 sides separately use:
border-width: 1px 2em 5px 0; /* top right bottom left */ border-style: solid dotted inset double; border-color: #f00 #0f0 #00f #ff0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With