Rotating out of the element with the transform rotate effect

I have rotated the text by 270 degrees and now I am facing the challenge of aligning it within another div.

Here is the original image before I rotated the text:

Below is the code I used for the layout:

#infoside {
    background-color: #00ff00;
    float: right;
    height: 100%;
    width: 41%;
}

#tabbings {
    float: left;
    width: 15%;
    height: 100%;
    background-color: #ffff00;
}
#tab_panels {
    float: right;
    width: 85%;
    height: 100%;
    background-color: #00ffff;
}

#client_info {
    height: 100px;
    width: 100%;
}


 <div id="infoside">
    <div id="tabbings">
        <div id="client_info" class="active_tabbing">
            <div id="text_here" style="width: 100px; height: 25%; text-align: center">
                 CLIENT INFO
            </div> 
        </div>
        <div class="clear"></div>
    </div>
    <div id="tab_panels"></div>
    <div class="clear"></div>
</div>

When I apply the class twist_text to the div with id text_here to rotate the text, the result is shown in the image below

.twist_text {
    -moz-transform: rotate(270deg);
    -webkit-transform: rotate(270deg) ;
    -o-transform: rotate(270deg) ;
    -ms-transform: rotate(270deg) ;
    transform: rotate(270deg);
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
}

How can I ensure that the rotated text fits perfectly inside the square?

Thank you.

Answer №1

To change the rotation axis of your div to the top left corner, apply transform-origin:0 0; in your CSS. The default position is 50% 50%, but you have the flexibility to customize it as needed.

Answer №2

If you're still unsure, give this a try:

.twist_text {
    -moz-transform: rotate(270deg) translateX(-35px);
    -webkit-transform: rotate(270deg) translateX(-35px);
    -o-transform: rotate(270deg) translateX(-35px);
    -ms-transform: rotate(270deg) translateX(-35px);
    transform: rotate(270deg) translateX(-35px);
}

Once you implement the above code, your text should appear as intended.

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

Using jQuery Ajax to Retrieve Inner Text from Elements

Looking for a solution with PHP file output like this: <div id="title">Add Us On Myspace!</div><img id="image" src="http://i39.tinypic.com/67jybs.png" alt="Add Us On Myspace!" /> The code to retrieve and display this is as follows... $ ...

`CSS animation for vanishing line effect`

I want to create an animated logo that gives the illusion of being pulled up by a rope, represented by a vertical black line, from the bottom of the page to the top. As the logo moves upwards, I would like the rope to disappear behind it, but I'm uns ...

An alternative to Beautiful Soup for Python 3.2

Looking to create a web crawler for extracting information from various web pages, I discovered Beautiful Soup which seemed like an excellent tool. It allows me to parse entire documents, create dom objects, iterate through them, and extract attributes sim ...

Best practices for handling multiple tables in AngularJS HTML

How can I loop through multiple tables in AngularJS? Here is an example of my HTML code: <div ng-repeat="stuff in moreStuff"> <table> <h1>{{stuff.name}}</h1> <tr ng-repeat="car in cars"> <td> ...

Ways to reduce lag while executing a for loop

How can I optimize my prime number generation process to avoid lagging? For example, is there a way to instantly display the results when generating primes up to 1000? HTML: <!DOCTYPE html> <html> <meta name="viewport" content="width=dev ...

showing database table contents on a website page

What is the best way to retrieve data from a MySQL database that corresponds to user input on a web page, and then showcase the content without having to reload the page using PHP or another suitable language? I would greatly appreciate any assistance wi ...

Adapting software for use with Panasonic Viera

We are in the process of transferring our current HTML/JavaScript/CSS application to the Panasonic platform. Our current setup involves using JavaScript for generating HTML and CSS for styling the application. The programming language used in the Panasoni ...

The icon for the weather on openweathermap is currently not displaying

Take a look at what my webpage looks like: http://prntscr.com/dg6dmm and also check out my codepen link: http://codepen.io/johnthorlby/pen/dOmaEr I am trying to extract the weather icon from the api call and display that icon (e.g. "02n") on the page base ...

PHP table not displaying data

I am brand new to this and currently enrolled in a class with an unhelpful professor. I am attempting to read data from a file into a table, but for some reason the data is not displaying. I have tried multiple approaches, but I am feeling quite lost. Any ...

Modifying the background hue of the element-ui tooltip

I am currently working with vue.js version 2.6.10 and element-ui version 2.15.1. The element-ui component I am using is as follows: <el-tooltip content="Top center" placement="top"> <span>Dark</span> ...

Unexpected arrows are being added to the dropdown menus in a responsive Twitter Bootstrap menu

I am puzzled by the behavior of my responsive twitter bootstrap nav. Take a look at this screenshot: The issue is with the strange up-pointing arrows that appear. The carets are fine, but these extra arrows are not desired. They disappear if I remove all ...

Discover the steps to download web page data using Objective-C while ensuring that JavaScript has finished executing

I attempted something similar: NSString *url = @"http://www.example.com"; NSURL *urlRequest = [NSURL URLWithString:url]; NSError *error = nil; NSString *htmlContent = [NSString stringWithContentsOfURL:urlrequest encoding:NSUTF8StringEncoding error:&e ...

Insert a page break after content for desktop browsers

Is it possible to control the display of sections on different screen sizes? I have a page that looks good on 15" laptops, but larger resolutions cause the next section to appear on the first screen. Is there a way to show the next section only on th ...

Utilize the 'document / redirect' API within an express controller function

Here is how I have an API call using document / redirect: This call is made within HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmln ...

Organize your table with CSS styling

Looking for a way to rearrange a table with 2 columns after every 2 rows so that the lines continue on the right side? Check out the example below: [1][2] [1][2][5][6] [3][4] => [3][4][7][8] [5][6] [7][8] Wondering if this can be achieved using o ...

Update the JavaScript and CSS files following an AJAX request with $.get

I am encountering an issue where my global CSS and JS files contain all the necessary definitions, but when I load new HTML blocks via AJAX $.get, these new elements do not receive the correct CSS/JS definitions. Is there a convenient way to refresh the ...

Django CSS graphical interface for selecting styles

I am looking to implement a feature that allows users to select an "interface theme": To enable users to change the theme across all templates, I have created a dropdown in my base.html. For all my HTML templates, I utilize a base.html file by extending ...

Mastering the art of using transitions in conjunction with display properties

I'm trying to achieve a fade-in effect with the CSS property display:block. Here's my HTML code: <div>Fade</div> And here's my CSS code: div { display: none; transition: 2s; } div:hover { display: block; } Unfortunately, thi ...

When implementing the navbar-fixed feature in Materialize, I've noticed that my icon disappears

Why does my icon disappear when using navbar-fixed with materialize, but not when I use the fixed navbar? Icon with regular navbar: Icon with navbar-fixed: ...

Restrict the maximum and minimum time that can be entered in an HTML input

I've implemented a basic code feature that allows users to input minutes and seconds on my React website. <div> <span> <input defaultValue="0" maxlength="2"/> </span> <span>m</span> <spa ...