Css – How to set a css border on one side only

bordercss

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?

Best Answer

#testdiv {
   border-left: 1px solid;
}

See the MDN documentation on border.