Rotate Text in HTML <thead> Tag

I need assistance with rotating a table header.

https://i.stack.imgur.com/hcvxx.png

The HTML th elements within the thead section are described as follows:

<th>
    <span class="rotate-all">Period</span>
</th>
<th>
    <span class="rotate-all">Location</span>
</th>
<th>
    <span class="rotate-all">Capacity (kWp)</span>
</th>
<th>
    <span class="rotate-all">Year 2016</span>
</th>
<!-- omit -->

I am attempting to rotate the span within each th element by 90 degrees, but I am facing difficulty achieving this effect through CSS.

Additional Information:

Creating HTML views using Javascript:

var makeTable = function (tableId, className, headerArray, contentArray) {
    return "<table class='" + className + "' id='" + tableId + "'>" + makeHeader(headerArray) + makeContentTr(contentArray) + "</table>";
}
var makeHeader = function (headerArray) {
    if (headerArray != undefined && headerArray != null && headerArray != "") {
        return "<thead><tr>" + makeHeaderContent(headerArray) + "</tr></thead>";
    } else {
        return "";
    }
};
var makeHeaderContent = function (headerArray) {
    var header = [];
    //Add an empty header to the first column if selectColumn option is true
    if (selectColumn) {
        headerArray = headerArray.slice();
        //Adds new items to the beginning of an array
        headerArray.unshift("<input type=\"checkbox\" class=\"select-all\" />");
    }
    for (var i = 0; i < headerArray.length; i++) {
        //Adds new items to the end of an array
        header.push("<th><span class=\"rotate-all\">" + headerArray[i] + "</span></th>");
    }
    return header.join(""); //Joins the elements of an array into a string
}

CSS Code:

.rotate-all{
    /* FF3.5+ */
    -moz-transform: rotate(-90.0deg);
    /* Opera 10.5 */
    -o-transform: rotate(-90.0deg);
    /* Saf3.1+, Chrome */
    -webkit-transform: rotate(-90.0deg);
    /* IE6,IE7 */
    filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=0.083);
    /* IE8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)";
    /* Standard */
    transform: rotate(-90.0deg);
    color:yellow;
} 

What adjustments should I make in the CSS code to achieve the desired rotation effect?

Answer №1

According to this discussion on Stack Overflow, the transform property is not applicable to inline elements: CSS transform doesn't work on inline elements

.rotate-all {
    display: block;
} 

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

What is the best way to update setState when triggering an onChange event?

Here is the code snippet for a React component that handles cryptocurrency selection: import React, { Component } from 'react'; import { Select } from 'antd'; import { connect } from "react-redux"; class SelecionarCrypto extends Compo ...

Creating a PHP script that retrieves data from JavaScript and stores it in MySQL can be accomplished by using AJAX to send the

Hello, I am attempting to create a PHP script that can extract coordinates from this JavaScript code (or from this link ) and store them in a MySQL database. Can someone please provide me with a tutorial on how to accomplish this? <script> var ...

Div with sidebar that sticks

I am currently working on setting up a website with a sticky sidebar. If you would like to see the page, click this link: On a specific subpage of the site, I am attempting to make an image Validator sticky, but unfortunately, it's not functioning a ...

What could be causing the calendar icon to not display in the table cell?

I've been working with the Bootstrap date picker inside a table, and I'm having trouble getting the date picker icon to display using the fas fa-calendar-alt css class. <td> <input type="text" id="expirydate{{$index}} ...

Using Vanilla JavaScript to Disable a Specific Key Combination on a Web Page

On a completely random English-Wikipedia editing page, there exists a way to add content (for example, "test") and save it using the existing key combination of Alt+Shift+S. My goal is to specifically prevent this action without removing the save button b ...

Updating HTML in Vue.js with data at a specific index value can be done by targeting

Experimenting with a combination of vue.js and vanilla to create a blackjack game. The card data is stored in the vue data() like this: data(){ return { cards: [ {id: 1, cardName: 'Ace of Spades', cardPic: ' ...

Transmitting a pair of data points to PHP using ajax POST for querying the SQL database

I am attempting to send two values from a form to another PHP file using the ajax post method. One value is the current input box value, while the other is the value being typed into a different input box which functions as a search box. When I execute the ...

Techniques for transferring information to Highchart directly from session storage

I am attempting to populate a pie highchart with data from a session storage variable, but I am not seeing any results. Here is the desired code: $(function () { Highcharts.chart('container', { chart: { type: 'pie', ...

Storing the values of three checkboxes in individual variables to be passed into distinct columns

Below is the HTML code for checkboxes, with a function that limits only three selections: <form class="interestSearchCriteria"> <input type="checkbox" name="walking" value="Walking"> Walking <input type="checkbox" name="running" value=" ...

Attempting to grasp the concept of implementing an If statement in conjunction with an event

Check out this HTML code snippet <body> <div> <button> Button A </button> <button> Button B </button> <button> Button C </button> </div> </body> This is my att ...

Certain visual elements fail to display properly within the web browser

I have a website with 5 pages (e.g. page1.html, page2.html, etc.), each having its own .css stylesheet. Oddly, some pages display images correctly while others do not. It seems like the issue might be with the specific pages or files, as using the same ima ...

Passing data to server-side PHP script using AJAX technology

Currently, I'm facing an issue with passing variables to a PHP script using onclick. It seems that I am making a mistake somewhere. To demonstrate the problem, let's say I have the following code snippet in my main page: <img src="myImage.jp ...

Tips on making a multiline label using html

Can anyone help me with creating a multiline label in HTML and MVC3 using Razor engine? I would appreciate any ideas. Thank you! ...

Align the image and caption at the center in Bootstrap 4

I am presenting a figure that includes an image along with a caption. Here is the code for reference: <figure class="figure"> <img src="../img/atmpressure.svg" class="figure-img img-fluid" alt="pressue plot"> <figcaption class="figure-c ...

What is the technique for extracting data from a Firebase application after a user has successfully logged in?

I'm currently facing an issue with my website's forum, which is integrated with Firebase for storing forum posts and user login information. The challenge I'm encountering involves retrieving data from the logged-in user's child in orde ...

Merge multiple Javascript files into one consolidated file

Organizing Files. /app /components /core /extensions - array.js - string.js /services - logger.js /lib - core.js Core.js (function() { 'use strict'; an ...

Sending a message through Discord.JS to a designated channel

Recently diving into Discord.JS, I am struggling to understand how to make my bot send a message to the General Chat when a new user joins. Many examples I've come across suggest using the following code: const channel = client.channels.cache.find(ch ...

Implementing a jQuery method in a PHP page that is loaded through AJAX

I am facing an issue on my page where I am using jquery/ajax to load a series of buttons into a div. This script loads buttons every time the user scrolls the page and each button should run a jquery function when clicked. The problem arises when I switche ...

Are you experiencing issues with the cross-origin request failing in react-map-gl?

While setting up a map in react-map-gl and providing my access token, I encountered the following console error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://events.mapbox.com/events/v2?access_token= ...

The importance of incorporating React into the scope of functional component development

While discussing class components, it's clear that they are part of the global React object. But why is it necessary to import them with every functional component? And do bundlers play a role in this requirement? I've been coding for 5 months n ...