I just did the opposite of this using :after and ::after , because I needed to make the bottom border exactly 1.3rem wider:
My element got super deformed when I used :before and :after at the same time because the elements are aligned horizontally with display: flex , flex-direction: row and align-items: center .
You can use this to create something broader or narrower, or perhaps any motive for the mathematical dimension:
a.nav_link-active { color: $e1-red; margin-top: 3.7rem; } a.nav_link-active:visited { color: $e1-red; } a.nav_link-active:after { content: ''; margin-top: 3.3rem; // margin and height should height: 0.4rem; // add up to active link margin background: $e1-red; margin-left: -$nav-spacer-margin; display: block; } a.nav_link-active::after { content: ''; margin-top: 3.3rem; // margin and height should height: 0.4rem; // add up to active link margin background: $e1-red; margin-right: -$nav-spacer-margin; display: block; }
Sorry, this is SCSS , just multiply the numbers by 10 and change the variables with some normal values.
agm1984 Nov 03 '17 at 7:20 2017-11-03 07:20
source share