Last active
October 10, 2019 20:55
-
-
Save Carnaux/1f6cc4a305af3befd9e0b7a972d8bce8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var color = "red"; | |
var per = 0.5; | |
var els = document.getElementsByClassName("u-s"); | |
for(let i = 0; i < els.length; i++){ | |
var height = els[i].offsetHeight; | |
var width = els[i].offsetWidth; | |
let underline = document.createElement('div'); | |
underline.style.width = width * per + "px"; | |
underline.style.height = 3 + "px"; | |
underline.style.backgroundColor = color; | |
underline.style.position = "relative"; | |
underline.style.left = width/2 - ((width *per)/2) + "px"; | |
underline.style.top = 3 + "px"; | |
els[i].appendChild(underline); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment