Created
January 19, 2018 10:43
-
-
Save tomraithel/d3bc49fb23ff66afc3dffcca3f105d81 to your computer and use it in GitHub Desktop.
Snippet to display data-qa attributes on a site
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
const cssText = ` | |
[data-qa] { | |
outline: 1px solid #E91E63 !important; | |
} | |
[data-qa]:hover { | |
outline: 2px solid #E91E63 !important; | |
} | |
[data-qa]:hover:before { | |
display: block; | |
white-space: nowrap; | |
content: attr(data-qa); | |
display: block; | |
position: absolute; | |
z-index: 2000; | |
height: 20px; | |
line-height: 20px; | |
padding: 5px; | |
background-color: #E91E63; | |
color: white; | |
font-size: 10px; | |
transform: translateY(-100%); | |
} | |
`; | |
const css = document.createElement('style'); | |
css.type = 'text/css'; | |
css.textContent = cssText; | |
document.body.appendChild(css); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment