Issue with CSS Transform Causing Rendering Errors in Both Chrome and Firefox

While a pixel here or there can be overlooked, in this case, precision is essential for the perfect rendering of this simple menu.
The spacing between menu items must be impeccably equal to avoid any merging or disjointed appearance.
Currently, the separators within the menu look messy and blurry, with some items blending together while others stand too far apart.
After a night's rest, it's evident that accepting whatever visual outcome presents itself is not an option - a designer must intervene.

Regardless of whether I try dashed or solid lines, the issue persists in every approach attempted.
Applying negative margins and adding borders does not resolve the problem,
These examples were tested on the latest versions of Chrome and Firefox in 2022.

Is there a method to create clear, sharp lines that separate the items evenly without the fuzzy, inconsistent anti-aliasing effect?

Feel free to rewrite the code completely or utilize flexbox or any other sophisticated CSS solution!


https://i.sstatic.net/Urwi2.png .............................. https://i.sstatic.net/bnbIk.png

nav ul{
    list-style: none;
    margin: 0;
    padding: 0;
}
nav {
    top: 0px;
    left: 0px;
    position: absolute;
    height: auto;
    display: inline-block;
    font-style: italic;
    font-size: 1.25em;
    padding: 0px 0 0 0;
}
nav li {
    background-color: blue;
    writing-mode: vertical-rl;
    transform: scale(-1);
    line-height: 1em;
    border-top: 1px dashed white;
}
nav li a {
    display:block;
    text-decoration: none;
    color: #fff;
    padding: 2em;
}
<nav>
  <ul>
    <li><a href="#">Bureau</a></li>
    <li><a href="#">Projecten</a></li>
    <li><a href="#">Diensten</a></li>
    <li><a href="#">Ontwerpen</a></li>
    <li><a href="#">Concepten</a></li>
    <li><a href="#">Kunsten</a></li>
  </ul>
</nav>

Answer №1

When dealing with borders and transforms, it can get tricky when you start applying transformations to the element itself. To avoid issues, try removing the transform:scale(-1) from the containing <li> elements and apply the transformation to the <a> instead:

nav li {
    background-color: blue;
    writing-mode: vertical-rl;
    line-height: 1em;
    border-top: 1px dashed white;
}
nav li a {
    display:block;
    text-decoration: none;
    color: #fff;
    padding: 2em;
    transform:rotate(180deg); <- other transforms are available :)
}

You can find a working example based on your code here: https://codepen.io/29b6/pen/KKQZywz

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

Getting Started with CSS Alignment - A Novice's Guide

Recently, I embarked on my journey to learn HTML and CSS with the ambition of creating a login page. Although I've successfully crafted a basic version, I'm encountering an issue where the input boxes and labels are misaligned, giving off an unpr ...

Enhancing User Experience with Interactive React Hover Effects

Hello, I have tried various combinations but still cannot get the desired background color to display when hovering over my <p> element. I am looking for a CSS-only solution and not interested in using JavaScript hover events. I would appreciate it ...

Issue with flex item not expanding to fill entire height within flex container

My markup contains the following code: .container { display: flex; width: 500px; } .col1 { background: red; height: 100%; width: 50px; } .col2 { background: blue; flex: 1; height: 200px; } <div class="container"> <div class= ...

How can I ensure that all the text is always in lowercase in my Angular project?

Is there a way to ensure that when a user enters text into an input field to search for a chip, the text is always converted to lowercase before being processed? Currently, it seems possible for a user to create multiple chips with variations in capitaliza ...

Utilizing AngularJS: A guide to implementing and manipulating arrays within HTML values

I've developed a unique custom directive incorporating the fields: ng-model, input-array <mydir ng-model="myBinding" input-array="input1,input2"></mydir> Data bindings for input 1 and input 2 are set up, but how can I intelligently gener ...

Changing between two images using HTML and CSS

I am currently designing a WordPress theme and I would like to create an effect where two different thumbnail images switch on hover. The code that I have come up with so far looks something like this : <a class="thumb" href="posturl"> <img src= ...

I'm having trouble getting my innerHTML command to update anything on the webpage, and the reason is eluding me

Below is the code snippet provided: <div id="js"><button onclick="document.getElementById('js').innerHTML=('<form> <input type=text name=tick1></input> <input type=text name=tick2></input> ...

Unresponsive Button_tag within a Rails table

The situation is as follows: I have a button_tag located within a form that is nested inside a table: <div class="table-responsive tableBG"> ** Interestingly, the button functions perfectly when placed here ** <table class="table table-striped ...

Is there a way to retrieve the list element that was added after the HTML was generated?

How can I reference a list element added using the append function in jQuery within my onclick function? See my code snippet below: $(function() { let $movies = $('#showList') let $m = $('#show') $.ajax({ method: 'GET ...

What is the method for deactivating a hyperlink with CSS?

Within my wordpress page, there is a specific link present. This particular link belongs to a class. Is it viable to deactivate this link solely through the use of CSS? <a class="select-slot__serviceStaffOrLocationButton___5GUjl"><i class="mater ...

Display the changing value at the beginning of the drop-down menu

I'm currently working on an AngularJS forEach loop where I need to display a dropdown list with dynamic values. The goal is to have the value stored in $scope.showCurrentProgram as the first selected element in the dropdown list when the page loads, a ...

I am finding it difficult to navigate relative paths when using Master Pages

I utilized Visual Studio 2010 to start a fresh project with the Web Application template. Without making any modifications, please note that Login.aspx and Default.aspx both point to the same Site.Master master page in the website root directory. Addition ...

What could be causing jQuery animate to malfunction on mobile devices when a viewport is present?

Everything seems to be working fine on my desktop webpage, but when I try it on mobile, there is no scroll... $("HTML, BODY").animate({ scrollTop: 500 }, 1000); This post suggests that mobile devices may not scroll on the body, but on the vi ...

What is the best way to extract the date January 1, 1970 from a datepicker?

Currently, I am utilizing a datepicker along with a function that converts dates from dd-mm-yyyy to yyyy-mm-dd format. The dates in the database are stored in yyyy-mm-dd format, so I need to first convert them to dd-mm-yyyy for better readability. When sub ...

Javascript enables the magnetization of cursor movements

Can a web page be designed so that when users open it and hover their mouse over a specific area outside of an image, the mouse is attracted to the image as if by a magnet? Is this idea feasible? Any suggestions would be appreciated. ...

Bootstrapvalidator does not function properly with select2.js

My code is not validating the select field. What could be causing this issue? Can anyone provide a solution? Apologies for my poor English, and thank you in advance for your response. Here is my form: <form name="form_tambah" class="form_tambah"> ...

modify rectangular section in drupal rather than numerical block

Currently, I am attempting to modify blocks within my Drupal 7.x website using the Zen base theme. While I have been successful in adjusting the CSS styles of the blocks based on their numbers in the block.css file, I find this method quite confusing. Is ...

Unable to Display CSS Background

Hey there, I've been experimenting with CSS backgrounds to create a header line consisting of 5 equally sized portions, each in a different color. I'm having trouble getting the background to display properly. Below is the code I have written. An ...

problem with CSS negative margin

When trying to position the navbar inside a div with the class main using negative margins, it causes issues on small screens when clicking on the toggler icon. How can I address this problem without relying on negative margins? <link rel="stylesheet" ...

Finding the precise top offset position with jQuery upon scrolling – a step-by-step guide

I need help with detecting the offset top of a TR element when it is clicked. It works fine initially, but once the page is scrolled, the offset().top value changes. How can I resolve this issue? $(function() { $('tr').click(function() { ...