Forked from 5t3ph/element-classes-and-ids-vanilla.css
Created
December 6, 2020 17:18
-
-
Save chriswitko/2870c6d61a547f0289ac05a3ff8e823f to your computer and use it in GitHub Desktop.
Tag HTML elements with their class names and IDs to visualize page structure
This file contains hidden or 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
| *[class], | |
| *[id] { | |
| position: relative; | |
| outline: 2px dashed red; | |
| &::before, | |
| &::after { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| z-index: 1; | |
| padding: 0.25em; | |
| background-color: red; | |
| color: #fff; | |
| font-weight: normal; | |
| font-family: sans-serif; | |
| font-size: .9rem; | |
| border: 1px solid #fff; | |
| } | |
| &[class]::before { | |
| content: "." attr(class); | |
| } | |
| &[id]::after { | |
| content: "#" attr(id); | |
| right: 0; | |
| left: auto; | |
| background-color: blue; | |
| } | |
| &[id] { | |
| outline-color: blue; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment