I've been attempting to design a cube with text on all its sides, but I've noticed that some of the sides display blurry text. Upon conducting a quick search online, I discovered that adding
-webkit-font-smoothing: subpixel-antialiased
to the container element fixed this issue for some users. However, it didn't work for me as four out of six sides still appear unclear. I would greatly appreciate any assistance in resolving this problem. Below is the code and a link to the JSFiddle example. Thanks in advance!
HTML:
<div id="options">
<ul id="nav">
<li id="front" class="show-front">Show 1</li>
<li id="back" class="show-back">Show 2</li>
<li id="right" class="show-right">Show 3</li>
<li id="left" class="show-left">Show 4</li>
<li id="top" class="show-top">Show 5</li>
<li id="bottom" class="show-bottom">Show 6</li>
</ul>
</div>
<div class="container">
<div id="cube" class="show-right">
<div class="side front"><h2>This is side 1</h2></div>
<div class="side back"><h2>This is side 2</h2></div>
<div class="side right"><h2>This is side 3</h2></div>
<div class="side left"><h2>This is side 4</h2></div>
<div class="side top"><h2>This is side 5</h2></div>
<div class="side bottom"><h2>This is side 6</h2></div>
</div>
</div>
CSS:
#nav {
list-style: none;
}
#nav li:hover {
cursor: pointer;
}
.container {
width: 600px;
height: 600px;
position: relative;
margin: 1em 1em 1em 2em;
float: left;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-ms-perspective: 1000px;
-o-perspective: 1000px;
perspective: 1000px;
}
.container #cube {
width: 100%;
height: 100%;
position: absolute;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-moz-transition: -moz-transform 1s;
-ms-transition: -ms-transform 1s;
-o-transition: -o-transform 1s;
transition: transform 1s
}
.container #cube .side {
background: black;
margin: 0px;
display: block;
position: absolute;
width: 596px;
height: 596px;
color: white;
border-radius: 5px;
box-shadow: 0 0 15px black;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
// More CSS styling...