Created
February 24, 2021 16:10
-
-
Save baileythegreen/fe5e3a65edce15405f02f012ace061a8 to your computer and use it in GitHub Desktop.
Make twitter photo alt-text visible on hover, have an indicator visible normally.
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
div[data-testid="tweetPhoto"]:not([aria-label="Image"]) { | |
margin: 0 !important; | |
} | |
div[data-testid="tweetPhoto"]:not([aria-label="Image"]):hover::after { | |
content: attr(aria-label); | |
width: 95%; | |
background: rgba(0,0,0,.75); | |
color: #fff; | |
padding: 10px; | |
font-family: sans-serif; | |
font-size: 10px; | |
} | |
div[data-testid="tweetPhoto"]:not([aria-label="Image"]):after { | |
width: 20px; | |
content: 'Alt'; | |
text-align: center; | |
background: rgba(0,0,0,.75); | |
color: DodgerBlue; | |
font-size: 12px; | |
} | |
/* Swaps state, so alt-text is visible except on hover. | |
div[data-testid="tweetPhoto"]:not([aria-label="Image"]):after { | |
content: attr(aria-label); | |
background: rgba(0,0,0,.75); | |
color: #fff; | |
padding: 10px; | |
font-family: sans-serif; | |
} | |
div[data-testid="tweetPhoto"]:not([aria-label="Image"]):hover::after { | |
content: ''; | |
background: rgba(0,0,0,0); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment