Setting box-sizing: border-box
makes it easier to manage element sizes by including padding and border in the element’s total width and height.
*, *:before, *:after {
box-sizing: border-box;
}
A comprehensive cheat sheet covering various CSS tricks, hacks, and optimizations for improved web development. Includes code snippets and examples for easy reference.
Setting
|
Using
|
|
Improves the readability of text by enabling kerning and ligatures. Example:
|
Gradient Text |
Applying a gradient to text using Example:
|
Text Stroke |
Adding a stroke to text using Example:
|
|
Makes the element vanish, but its children become direct children of the element’s parent. Example:
|
Enabling native-like iOS scrolling using
|
Preventing iOS scrolling on certain elements.
|
SCSS Mixin for iOS Scrollable Elements
|
Optimizations for UIWebView, such as disabling tap highlight color and user selection.
See: iOS WebKit UIWebView Remove Tap/Click Highlight Border with CSS |
Targeting Mozilla Firefox using
|
Targeting Webkit browsers using
|
A basic CSS reset to normalize styles across browsers.
|
Normalizing various HTML elements for consistent styling.
|