Skip to content

Instantly share code, notes, and snippets.

@tomraithel
Created January 19, 2018 10:43
Show Gist options
  • Save tomraithel/d3bc49fb23ff66afc3dffcca3f105d81 to your computer and use it in GitHub Desktop.
Save tomraithel/d3bc49fb23ff66afc3dffcca3f105d81 to your computer and use it in GitHub Desktop.
Snippet to display data-qa attributes on a site
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