Created
January 16, 2019 18:56
-
-
Save weirdpattern/2bb448a481028531f6d783260f0cbcda 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
2019.01.16.adding-content-via-css-attr |
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
<html> | |
<head> | |
<style> | |
.simple:before { | |
content: attr(message) ", I'm a div with a 'message' attribute"; | |
} | |
.data-based:before { | |
content: attr(data-message) ", I'm a div with a 'data-message' attribute"; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="simple" message="Hello there"></div> | |
<div class="data-based" data-message="Hello there"></div> | |
</body> | |
</html> |
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
<selector>:[before|after] { | |
content: [attr(<attribute>) | 'plain text'] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment