Last active
March 23, 2021 00:33
-
-
Save pixelspencil/13c5052880091344ab58deb02f18721e to your computer and use it in GitHub Desktop.
CSS Snippets
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
```css | |
selector { | |
color: #000000; | |
background: #ffffff77 | |
} | |
``` | |
/* | |
- Instead of using rgba() you can use #00000078, the last two digits are the alpha value 00-ff | |
- [1 2 3 4 5 6 7 8 9 A B C D E F] | |
- [Further reading](https://www.digitalocean.com/community/tutorials/css-hex-code-colors-alpha-values#adding-an-alpha-value-to-your-hex-codes) | |
*/ |
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
```css | |
.truncate { | |
width: 250px; | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} | |
``` | |
/* | |
- Just add the truncate class to the text element. | |
- [Further reading](https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/) | |
*/ |
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
/* | |
This snippet will highlight an image has no alt text: | |
"You forgot the image alt attribute" | |
*/ | |
img[alt=""], | |
img:not([alt]) { | |
border: 5px dashed #c00; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment