css-diagonal-separators
css-diagonal-separators copied to clipboard
Pure CSS Diagonal Separators
Pure CSS Diagonal Separators
Read The full post on Code Pen
Notes:
- CSS Variables are used for demonstration purposes and future prosperity, they are yet to be supported across all browsers and rendering engines!
reversed&verticalvariants listed below are verbose for demonstration purposes
- for simple multi directional variants, use the
rotate()function as needed- see the
style.cssof each method for a detailed example- Use with
transparentcolors (e.g. to overlay an image, or content) will requireabsoluteor manual positioning:
- see the
layout.cssfor a detailed example
Comparision Matrix
| Method | Simple CSS | Generated Content | Cross Browser Support | Performance |
|---|---|---|---|---|
| Borders | ✔ | ✔ | ✔ | ✖ |
| CSS Shapes | ✖ | ✖ | ✖ | ✖ |
| Gradient Background Image | ✔ | ✔ | ✖ | ✔ |
| SVG Background Image | ❓ | ✔ | ✔ | ✔ |
| SVG Mask | ✖ | ✖ | ✖ | ✖ |
| CSS3 2D Transforms | ✖ | ✖ | ✖ | ✖ |
Results
- Simple CSS
- 🥇 Borders
- 🥈 Gradient Background Image
- 🥉 CSS Shapes
- Generated Content
- 🥇 Borders
- 🥈 Gradient Background Image
- 🥉 SVG Background Image
- Cross Browser Support
- 🥇 Borders
- 🥈 SVG Background Image
- 🥉 CSS Shapes
- Performance
- 🥇 Gradient Background Image
- 🥈 SVG Background Image
- 🥉 Borders