fuzzy lettering on specific edges of three-dimensional cube

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!

JSFiddle Link

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...

Answer №1

In a recent discussion on Stack Overflow, it was discovered that WebKit treats text as textures rather than vectors after transformation. This means that the initial rendering of text benefits from vector graphics, while subsequent renderings rely on textures.

To improve text quality, try increasing the font size and then reducing it using the CSS property -webkit-transform: scale. This technique effectively creates a higher-resolution texture. While I can't take credit for this solution (thanks to Duopixel), I have updated your code in this fiddle. It is recommended to use a sans-serif font like Arial, as they tend to handle scaling better than serif fonts. In my example code, I used Arial for the headers:

h2 {
    font-family: 'Arial';
    font-size: 120px;
    font-weight: 100;
    text-align: center;
    -webkit-transform: scale(.5);
}

Good luck with your project!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for showcasing several thumbnails simultaneously as you upload images on a webpage with HTML and JavaScript

function displayImage(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function(e) { $('#selectedImage') .attr('src', e.target.result) }; reader.read ...

Angular 8 allows for the creation of custom checkboxes with unique content contained within the checkbox itself, enabling multiple selection

I'm in need of a custom checkbox with content inside that allows for multiple selections, similar to the example below: https://i.sstatic.net/CbNXv.png <div class="row"> <div class="form-group"> <input type ...

Achieving a Photo Grid Layout with CSS

Looking for help with my CSS photogrid - it's close to what I want, but not quite there. Here's the layout I'm aiming for: 1 | 2 | 3 4 | 5 | 6 But currently, it displays like this: 1 | 3 | 5 2 | 4 | 6 I've tried tweaking the CSS but ...

Immersive Visual Symphony through Dynamic Multi-Layered

My goal is to create captivating animations for my multiple background images. Here's the CSS code I've come up with: .header { background-image: url('/img/cloud2.png'), url('/img/cloud3.png'), url('/img/cloud1.png&apos ...

What is the best way to choose the first div when there are multiple divs with the same name?

Is there a way to target only the first div with a specific class in a series of divs with the same name using CSS? Here is an example scenario: <div class="div">dsdas</div> <div class="div">123</div> <div class="div">73</ ...

How can I make columns with a max-width expand fluidly?

I am currently using a fluid/responsive column layout that looks like this: .row{ float:left; max-width:960px; width:100%; } .column{ float:left; margin:0 15px; } .column:first-child{ margin-left:0; } .column:last-child{ mar ...

Ways To Create Multiple HTML Players

After successfully creating an audio player with html, css and javascript, I now face the challenge of adding multiple players to a single page. However, when attempting to play any player besides the first one, it only plays the initial player. How can ...

Steps for positioning a z-indexed division

In my main wrapper, which has a fixed width of 960px, there is a login button located at the top right corner. When this button is pressed, a div layer opens directly below and in front of the main wrapper using z-index: 1. The issue I am facing is that I ...

The alignment of my card icons changes depending on the size of the paragraph

Here are my cards I am attempting to give them a relative position and the parent div an absolute position, but it is not working as expected. Despite several attempts, I still cannot get the desired result of positioning the cards correctly within the p ...

The outline feature cannot be applied to buttons within a btn-group in Bootstrap 4

I have successfully removed the outline for a single button, but I am struggling to remove it for a button within a btn-group class. Check out my JSFiddle DEMO This is the HTML code I am working with: <button class="btn btn-primary">Button without ...

${IDHERE} element's text color not changing when tab is switched

One dilemma I encountered involves displaying a percentage on a webpage with 2 tabs. The percentage is originally shown on the tab that is open when the page loads. The JavaScript code I used is quite straightforward: adaPercentColor(percent, ada) { ...

Guide to aligning a WordPress div to the top of the webpage

Currently, I am in the process of creating a page template that features a transparent header. My main goal is to have the #content div align perfectly with the top of the page right below the header. I have experimented with various CSS properties such a ...

How come my div can alter its own attributes on hover, but its sibling cannot?

As I delve into the realm of web development, my initial project involves creating a portfolio site. However, I am facing difficulties with the dropdown section in one of the menus. I incorporated a :hover pseudo-class to the dropdownhover div to signal ...

JavaScript array images are not showing when using the img tag

For this module, I am working on creating a flipbook (magazine) using images stored in a JavaScript array. However, I am facing an issue where the images are not loading up properly. Instead of displaying the image, it shows as [object" htmlimageelement]=" ...

A handy PHP tool designed to create CSS shorthand code efficiently

Currently, I am programming a PHP script to generate dynamic CSS styles. Each value is specified individually like so: $padding_top = 10; $padding_bottom = 10; $padding_left = 10; $padding_right = 10; My goal now is to create shorthand CSS rules where ...

Does this extensive combination of pseudo classes hold true?

Here's the code snippet I am working with: .fontmenu .fontlist{ position: absolute; bottom:30px; display:none; } .fontbutton button:hover .fontmenu .fontlist{ display:block; } <div class="fontmenu"> ...

Flipping and expanding cards with CSS3

I am attempting to create a layout with a collection of cards/divs within a container. When a card/div is clicked, it should flip horizontally and expand to occupy the entire space within the container (essentially resizing to 100% x 100% when clicked). I ...

I am having trouble aligning the unordered list in the center

My struggle lies in centering the ul element which serves as a menu. Despite trying various CSS properties such as margin: 0 auto;, text-align: center;, and adjusting the margin value, I am unable to achieve the desired result. This is the CSS code I have ...

Switch up the order of columns by utilizing the push and pull features of Bootstrap

My layout consists of 3 columns arranged like this: <div class="container-fluid"> <h1>Hello World!</h1> <p>Resize the browser window to see the effect.</p> <div class="row"> <div class="col-sm-3">left co ...

Tips for enhancing the "Eliminate render-blocking resources" score on the Lighthouse report for Progressive Web App (PWA) optimization

Check out my first attempt at a PWA here: My goal is to achieve a perfect 100% in Lighthouse for all categories :) https://i.sstatic.net/9Ql9r.png Although I've read the "Learn More" page, I'm still struggling with how to implement Bootstrap C ...