Rotating text across different browsers using CSS

Having difficulties achieving text rotation that works smoothly in both Chrome and IE (11.0). The issue is that in IE, the text rotates 180 or 360 degrees instead of the desired 90 or 270 degrees.

Here are the CSS styles I have experimented with:

.rot90 {
    -webkit-transform:rotate(90deg);
    -moz-transform:rotate(90deg);
    -ms-transform:rotate(90deg);
    -o-transform:rotate(90deg);
    transform:rotate(90deg);

    -webkit-transform-origin: 0px 0px;
    -moz-transform-origin: 0px 0px;
    -ms-transform-origin: 0px 0px;
    -o-transform-origin: 0px 0px;
    transform-origin: 0px 0px;

    border: 0px solid;
    white-space: nowrap;
    position:absolute;
    display:inline-block;

    padding-bottom: 5px;

    writing-mode: tb-rl;
}

.rot270 {
    -webkit-transform:rotate(270deg);
    -moz-transform:rotate(270deg);
    -ms-transform:rotate(270deg);
    -o-transform:rotate(270deg);
    transform:rotate(270deg);

    -webkit-transform-origin: 0px 0px;
    -moz-transform-origin: 0px 0px;
    -ms-transform-origin: 0px 0px;
    -o-transform-origin: 0px 0px;
    transform-origin: 0px 0px;

    border: 0px solid;
    white-space: nowrap;
    position:absolute;
    display:inline-block;

    padding-bottom: 5px;

    writing-mode: tb-rl;
}

The requirement is for the transform origin to be set at: 0px 0px.

Explore this jsfiddle link for visual demonstration:

Alternatively, check out this jsfiddle using the helpful CSS Matrix Rotation Calculator:

UPDATE

A functional solution based on the selected answer can be found here, highlighting how the 'writing-mode' property had a significant impact on the outcome: https://jsfiddle.net/wonc4px9/6/

.rot90 {
    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.00000000, M12=-1.00000000, M21=1.00000000, M22=0.00000000,sizingMethod='auto expand')";
    filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.00000000, M12=-1.00000000, M21=1.00000000, M22=0.00000000,sizingMethod='auto expand');
    -moz-transform:  matrix(0.00000000, 1.00000000, -1.00000000, 0.00000000, 0, 0);
    -webkit-transform:  matrix(0.00000000, 1.00000000, -1.00000000, 0.00000000, 0, 0);
    -o-transform:  matrix(0.00000000, 1.00000000, -1.00000000, 0.00000000, 0, 0);

    -ms-transform: rotate(90deg);

    -webkit-transform-origin: 0px 0px;
    -moz-transform-origin: 0px 0px;
    -ms-transform-origin: 0px 0px;
    -o-transform-origin: 0px 0px;
    transform-origin: 0px 0px;

    border: 0px solid;
    white-space: nowrap;
    position:absolute;
    display:inline-block;

    padding-bottom: 5px;
}

.rot270 {

    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=-0.00000000, M12=1.00000000, M21=-1.00000000, M22=-0.00000000,sizingMethod='auto expand')";
    filter: progid:DXImageTransform.Microsoft.Matrix(M11=-0.00000000, M12=1.00000000, M21=-1.00000000, M22=-0.00000000,sizingMethod='auto expand');
    -moz-transform:  matrix(-0.00000000, -1.00000000, 1.00000000, -0.00000000, 0, 0);
    -webkit-transform:  matrix(-0.00000000, -1.00000000, 1.00000000, -0.00000000, 0, 0);
    -o-transform:  matrix(-0.00000000, -1.00000000, 1.00000000, -0.00000000, 0, 0);

    -ms-transform: rotate(270deg);

    -webkit-transform-origin: 0px 0px;
    -moz-transform-origin: 0px 0px;
    -ms-transform-origin: 0px 0px;
    -o-transform-origin: 0px 0px;
    transform-origin: 0px 0px;

    border: 0px solid;
    white-space: nowrap;
    position:absolute;
    display:inline-block;

    padding-bottom: 5px;
}

Answer №1

Check out this useful tool for generating a CSS rule tailored for Internet Explorer. Matrix Calculator

The explanation provided in the answer section will guide you on how to utilize the generated rule and why it is necessary.

Your CSS rule will resemble the following code snippet:

.rot90 {
-ms-filter:"The rule obtained from using the Matrix Calculator"
-webkit-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-ms-transform:rotate(90deg);
-o-transform:rotate(90deg);
transform:rotate(90deg);

-webkit-transform-origin: 0px 0px;
-moz-transform-origin: 0px 0px;
-ms-transform-origin: 0px 0px;
-o-transform-origin: 0px 0px;
transform-origin: 0x 0px;

border: 0px solid;
white-space: nowrap;
position: absolute;
display: inline-block;

padding-bottom: 5px;

writing-mode: tb-rl;}

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

Choose an image and save the selection information for the following page (Tarot card)

I'm in the process of creating a website that showcases multiple tarot cards. The goal is for users to select the cards they're interested in and have their chosen card displayed on the next page. I've implemented some code for selecting the ...

Adjust the placement of the outcome on the table using PHP

I am attempting to display 7 results in a table (image 1) and need to adjust their positioning. In the array, Mon = 1 and Sun = 7. Where there are no values, I want them to display as $0. However, I am struggling to move them to the correct spot on the ta ...

Guide to creating a see-through right border for vertical tabs using Bootstrap 4

I have been working on creating vertical tabs in Bootstrap 4 and have almost completed the task. However, I am facing an issue with making the right border of the active tab transparent. Despite several attempts, I have not been successful in achieving thi ...

Challenges with finding web elements using Selenium

Having trouble finding a specific web element on a dynamic website? The elements you're looking for have similar attributes to others, with slight differences like changing integers. Unfortunately, these integers also change upon page refresh, making ...

CSS positional sequencing dilemma

I am having trouble with the layout in this particular scenario: . In the #boxOne div, I have a link followed by a div (#formloc) containing an input and another link. Even though the first link ("Appliquer une localisation") is placed before the #formlo ...

Uploading API documentation from .chm files

Currently in the process of documenting our extensive code base using Sandcastle to generate .chm files with inserted XML comments. My next step is hosting these files on our server as a website for easy access rather than distributing documentation indi ...

Button to close CSS overlay scrolls to the top of the page

I have managed to create a CSS-only solution where clicking on an anchor displays an overlay image on top of a div. Everything works smoothly except for one issue: when the close button is clicked, it scrolls to the top of the page instead of closing and s ...

Pair objects that possess a specific attribute

I have a HTML snippet that I want to modify by adding the CSS class HideEdit to hide specific columns. <th class="rgHeader" style="text-align: left;" scope="col" _events="[object Object]" control="[object Object]" UniqueName="Edit"> This particular ...

Styling the <Autocomplete/> component in Material UI with React to achieve rounded corners

Google's search bar has always been a favorite of mine, with its rounded corners and generous text padding. https://i.stack.imgur.com/UbKrr.png I'm attempting to replicate this aesthetic using Material UI's <Autocomplete/> component ...

Exploring the exciting possibilities of combining lottie-interactivity with Wix (Editor X) to create captivating scroll-based animations

Seeking advice on how to synchronize a lottie animation with the scroll position on my Editor X (similar to Wix but with enhanced features) website. After researching the lottie-interactivity documentation, I learned that Editor X utilizes Wix's Velo ...

Can you display a simple HTML view?

I am currently working on a Node.js application with Express framework. In my project, I have a 'views' folder containing an 'index.html' file. However, upon trying to load the webpage, I encountered the following error: Error: Cannot f ...

Click here for a hyperlink with an underline that is the same width

As we work on our website, we want a unique feature where links are underlined when hovered over, with the underline staying the same width regardless of the length of the link text. How can we achieve this using CSS/jQuery/Javascript? ...

Incorporating a read more section in WordPress with a div

I've been trying to implement a read more button with a div, but it doesn't seem to be working. I'm unsure of the correct approach to take. Below is the code I am using: <?php the_content('<a href="<?php the_permalink() ?> ...

What is the best way to include two classes within a span element?

I am currently utilizing bootstrap 5 along with bootstrap-select. I have a PSD design similar to this: https://i.sstatic.net/XTO1S.png <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="view ...

I am having trouble getting all the HTML content to properly display in the GitHub zip file

I am encountering an issue where the index.html file is not displaying the navigation or images as expected. For reference, the project can be found at https://github.com/LawlietBlack/Persona-4-Golden-Guide If there is a more appropriate place to ask this ...

How come it's so difficult to set the perspective camera to accurately display sizes in three js?

Currently, I am using Three Js to create a visual representation of a car. However, I am encountering an issue with the perspective camera that I can't seem to resolve. My goal is to make it appear more realistic by only showing the front of the car, ...

Generating output into several spans of identical class using JavaScript with compatibility for IE8

Trying to make sense of GetElementsbyClassName function here. My goal is to output the value of an input field, identified by ID, to multiple spans that share a common class on click. I had it working fine with ElementId, but now I need to repeat the user ...

Exploring the world of mathematics using JavaScript, adjusting the range input, and applying CSS transform with scale()

In my project, I have a container div set to a width of 794px and a range input with a maximum value of 250 and a minimum of 0. I am using CSS transform property like this: scale(1), where the scale is equivalent to 794px. The challenge arises when the br ...

Is it possible to convert xaml to html in a silverlight newsletter?

Currently, I am working on a project that involves creating a webpage where my admin can send emails directly through the website. To achieve this functionality, I have implemented a code snippet to send emails to all subscribers. foreach (Subscription pe ...

Tips for preventing divs from sliding to the next row when adding margin in Bootstrap

{% for plant in plants %} {% if forloop.counter0|divisibleby:3 %} <div class="row row-cols-3"> {% endif %} {% include 'included/_plant_cell.html' %} {% if forloop.counter|divisibleby:3 %} </div&g ...