You can use box-shadow
to create an outline on one side. Like outline
, box-shadow
does not change the size of the box model.
This puts a line on top:
box-shadow: 0 -1px 0 #000;
I made a jsFiddle where you can check it out in action.
INSET
For an inset border, use the inset keyword. This puts an inset line on top:
box-shadow: 0 1px 0 #000 inset;
Multiple lines can be added using comma-separated statements. This puts an inset line on the top and the left:
box-shadow: 0 1px 0 #000 inset,
1px 0 0 #000 inset;
For more details on how box-shadow
works, check out the MDN page.