arranging a div after it has undergone rotation

I have an idea to create a div containing three texts, rotate it, and place it in a fixed position on the page. My goal is to make sure it fits perfectly on the screen.

To achieve this, I initially created a div with height and width that were the opposite of what was required and then rotated it accordingly. However, I am facing some difficulties in properly positioning it at the desired spot (top: 0, right: 40px).

Below is the code snippet where I attempted to adjust the div’s placement:

.page {
  width: 100%;
  heigth: 100%;
  background-color: #fefefe;
}
.green-band {
  height: 90px;
  width: 100vh;
  padding: 0 30px;
  background-color: green;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: rotate(-90deg);
  position: fixed;
  top: 0;
  right: 40px;
}
<div class="page"></div>
<div class="green-band">
  <div class="text-inside">Text 1</div>
  <div class="text-inside">Text 2</div>
  <div class="text-inside">Text 3</div>
</div>

Could someone assist me in correctly adjusting the position of the div?

Answer №1

.page {
  width: 100%;
  heigth: 100%;
  background-color: #fefefe;
}
.green-band {
  height: 90px;
  width: 100vh;
  padding: 0 30px;
  background-color: green;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateX(calc(100% - 40px)) rotate(-90deg);
  transform-origin: bottom left;
  position: fixed;
  bottom: 0;
  right: 0;
}
<div class="page"></div>
<div class="green-band">
  <div class="text-inside">Text A</div>
  <div class="text-inside">Text B</div>
  <div class="text-inside">Text C</div>
</div>

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

Guide on showing a URL within an onclick event using the jQuery Append method

My method involves using AJAX to upload images and then displaying the uploaded image by utilizing the jQuery append function. The challenge comes when I try to add an onclick event to the specific image tag. To tackle this, I start by creating a JavaScri ...

Highlight the desired text and use JavaScript to automatically scroll to it

I've been searching for a solution to this problem for hours now, but I haven't had any success yet. Is there a way to highlight specific text within a textarea and automatically scroll to that selection? I attempted to use scrollTop, but I' ...

Why does the <select> dropdown flash when I select it?

Currently utilizing Angular 1.3 and Bootstrap 3.3.x CSS without the JS functionality. There is also an interesting animated GIF embedded within. <div class="form-group"> <div class="col-lg-3"> <label clas ...

Ways to adjust dimensions depending on zoom level or screen size

Here is the HTML code snippet: <div id="divMainFirst"> <div id="divInnerFirst"> <div id="divTitleHeaderUC"> <span id="spanTitleHeaderUC">Urgent Care Wait Time</span> </d ...

Excessive CPU/GPU usage caused by CSS transition animations

I am currently working on a small element on my website that involves a random size change in one of the DOM elements. const theDiv = document.getElementById("the-div"); function animate(){ const value = Math.floor(Math.random() * 200); theDiv.sty ...

How to stop the previous page from reloading with Express.js routing?

Just starting out with express and web development in general, I have a question regarding routing. Currently, I am working on a web app using Firebase with pure JS and implementing routing on Firebase cloud functions. The routing logic is outlined below: ...

Verify whether the user's email is registered in the database

I have a login form and I want to verify if a user's email exists in the database, but I'm not sure about the syntax for integrating Angular with Node. In my Main.js file, I have an ng-click on the submit button that triggers this function. I ex ...

What is preventing me from modifying the icon on a dropdown menu?

I've been struggling to change my dropdown icon from the default "carrot" to a Fontawesome one. Despite researching other questions, I still can't find a solution that works for me. <form> <div class="form-group"> <select disab ...

Error: scrollreveal JavaScript is not properly defined

Desperately seeking guidance on a particular code snippet... window.sr = ScrollReveal({ reset: true }); sr.reveal('.whitecircle, .circleStatsItemBox, .circleStat', { duration: 200 }); function circle_program() { var divElement = $(&apo ...

jq mobile link triggering unexpected scroll to page bottom

Seeking assistance from the community. I am currently working on an app in PhoneGap with jQuery Mobile and facing a problem whereby when there is a hyperlink in the text below the 'fold' of the iPhone screen, the page automatically jumps to the b ...

Unable to retrieve the text enclosed between the:: before and after the:: marker

I attempted this using the XPATH finder in Chrome, and it highlighted the element. However, when running my Selenium script, I received the following error: Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: ...

React component using Highcharts is displaying categories as numeric values instead of text

Incorporating the highcharts-react package (https://github.com/highcharts/highcharts-react) into my Laravel project has presented a unique challenge. I am attempting to fetch data from my reducer and transform it into a string to populate the categories in ...

Is there a way to view the contents of a file uploaded from <input type="file" /> without the need to send it to a server?

Having trouble uploading a JSON file from my local disk to Chrome storage. Whenever I use the <input type="file"> tag and useRef on the current value, it only returns the filename prefixed with 'C:\fakepath...' ImportExport Component: ...

Eliminating render-blocking CSS in PageSpeed - one stylesheet at a time

Currently, I am testing the best optimization practices for front-end development. As part of this process, I have utilized gulp and npm to merge and minify my CSS and JS files into a single all.min.css and js.min.css file. Upon analyzing my website using ...

Zod: Generate a basic item using default settings

I have a strong belief that this concept exists, however, my research has not yielded any results. Let's consider a scenario where I have a zod Schema structured like this: const Person = zod.object({ name: z.string().default(''), ag ...

Leveraging JavaScript Variables with Android Development

How can I extract a JavaScript variable from a website and incorporate it into my code? I followed the steps in this guide to display the string in an alert message, but now I'm unsure how to use it outside of the alert. Any advice would be appreciate ...

How to generate a hyperlink using the GitHub API with JavaScript/jQuery

I have a table of commits displaying the SHA, author, message, and date of each commit I made in a specific GitHub repository. Is there a way to turn the message column into a clickable link that directs to the corresponding GitHub page showing details of ...

Is there a way to trigger an ajax call specifically on the textarea that has been expanded through jQuery?

Whenever I expand a textarea from three textareas, all three trigger an ajax call. Is there a way to only call the ajax for the specific expanded textarea? I tried using $(this).closest('textarea').attr('id'), but it didn't work. A ...

"Attempt to create angular fork results in an unsuccessful build

I have recently created a fork of angularJs and I am facing an issue when trying to build it. The build process fails when running grunt package npm -v --> 3.5.2 bower --version --> 1.7.2 I followed the steps provided in the official documentation ...

Unable to retrieve dynamic variable values from URL in Node.js using ES6 template strings

Below is the code snippet I am using: let urlString = https://${process.env.API_KEY}:${process.env.API_TOKEN}${process.env.SUBDOMAIN}/v1/Accounts/${process.env.ID}/Calls/connect However, the values of variables API_KEY , API_TOKEN , SUBDOMAIN and ID are ...