I have a row that I am applying a background highlight to on hover.
.jobs .item:hover {
background: #e1e1e1;
border-top: 1px solid #d0d0d0;
}
However, as the border adds 1px additional to the element, it makes it ‘move’. How would I compensate for the above movement here (without using a background image)?
You can make the border transparent. In this way it exists, but is invisible, so it doesn’t push anything around:
For elements that already have a border, and you don’t want them to move, you can use negative margins:
Another possible trick for adding width to an existing border is to add a
box-shadowwith the spread attribute of the desired pixel width.