- Notifications
You must be signed in to change notification settings - Fork5
apply-a-conditional-border-without-moving-element.md
18 lines (14 loc) · 507 Bytes
apply-a-conditional-border-without-moving-element.md
When you allow a user's behavior to add or remove a border from an element,that can cause the page to 'jump around' as the border is added or removed. Acommon example is a border around an element that is 'selected'.
Fix this issue by adding a transparent border around the element and giving itcolor when it's selected. No more jumps.
.element {border:1pxsolidtransparent;}.selectedElement {border-color:$selected-color;}