CSS Only Single-Element 3D Cuboid
How do I make an css only single-element 3d cuboid?
Cuboid made using only one div with the before and after selectors and skew. Updated to include configurable values with the help of SASS.. What is a css only single-element 3d cuboid? How do you make a css only single-element 3d cuboid? This script and codes were developed by Assaf Gelber on 03 January 2023, Tuesday.
CSS Only Single-Element 3D Cuboid - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Only Single-Element 3D Cuboid</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { text-align: center; text-align: center; font-family: "Arial";
}
h1 { text-transform: uppercase;
}
.cuboid { width: 200px; height: 200px; margin: 50px 20px; background-color: #ccc; position: relative; display: inline-block;
}
.cuboid-lb:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: -20px; top: 10px; transform: skew(0, -45deg);
}
.cuboid-lb:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: 100%; left: -10px; transform: skew(-45deg);
}
.cuboid-lt:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: -20px; top: -10px; transform: skew(0, 45deg);
}
.cuboid-lt:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: -20px; left: -10px; transform: skew(45deg);
}
.cuboid-rb:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: 100%; top: 10px; transform: skew(0, 45deg);
}
.cuboid-rb:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: 100%; left: 10px; transform: skew(45deg);
}
.cuboid-rt:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: 100%; top: -10px; transform: skew(0, -45deg);
}
.cuboid-rt:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: -20px; left: 10px; transform: skew(-45deg);
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1> css only single-element cuboids
</h1>
<div class='cuboid cuboid-lb'></div>
<div class='cuboid cuboid-lt'></div>
<div class='cuboid cuboid-rb'></div>
<div class='cuboid cuboid-rt'></div>
<h4> (Try playing around with the SASS variables in the first 4 lines)
</h4>
</body>
</html>
CSS Only Single-Element 3D Cuboid - Script Codes CSS Codes
body { text-align: center; text-align: center; font-family: "Arial";
}
h1 { text-transform: uppercase;
}
.cuboid { width: 200px; height: 200px; margin: 50px 20px; background-color: #ccc; position: relative; display: inline-block;
}
.cuboid-lb:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: -20px; top: 10px; transform: skew(0, -45deg);
}
.cuboid-lb:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: 100%; left: -10px; transform: skew(-45deg);
}
.cuboid-lt:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: -20px; top: -10px; transform: skew(0, 45deg);
}
.cuboid-lt:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: -20px; left: -10px; transform: skew(45deg);
}
.cuboid-rb:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: 100%; top: 10px; transform: skew(0, 45deg);
}
.cuboid-rb:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: 100%; left: 10px; transform: skew(45deg);
}
.cuboid-rt:before { content: ""; height: 200px; width: 20px; background-color: #b3b3b3; position: absolute; left: 100%; top: -10px; transform: skew(0, -45deg);
}
.cuboid-rt:after { content: ""; width: 200px; height: 20px; background-color: #999999; position: absolute; top: -20px; left: 10px; transform: skew(-45deg);
}
Developer | Assaf Gelber |
Username | agelber |
Uploaded | January 03, 2023 |
Rating | 3.5 |
Size | 2,913 Kb |
Views | 10,120 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Interactive CSS 3D Transform | 3,690 Kb |
CSS Animated Bio Card | 4,004 Kb |
Posting Animation | 4,524 Kb |
Pure CSS Image Gallery | 3,911 Kb |
Perspective Demo | 3,143 Kb |
Carousel Tutorial Demo | 3,266 Kb |
Text Looping Transition | 5,619 Kb |
Rotate Demo | 3,061 Kb |
ScaleZ Demo | 3,184 Kb |
Simple Night Sky | 3,266 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Glitchy Text Effect | Kescoe | 2,208 Kb |
Layout 11 | Altynai | 1,690 Kb |
Video mute | Leon9208 | 2,131 Kb |
Exploding Text | Jjmartucci | 4,749 Kb |
My Interests | Anshusaxenaarora | 2,015 Kb |
APortfolio | Skybutterfly | 5,174 Kb |
Simple Login Form | JoshBlackwood | 4,418 Kb |
404 Page | Saransh | 2,666 Kb |
P1 | Vivi_Lai | 1,533 Kb |
Contact | GanNichiHa | 2,514 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!