CSS to Vertically Display Input Values

Having an input field with type=number in a React application styled using styled-components, I am looking to have certain inputs display their values vertically.

export const UnitValue = styled.input`
  ::-webkit-inner-spin-button,
  ::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
  }
  font-weight: bold;
  text-align: center;
  margin-right: ${props => {props.marginRight};
  margin-top: ${props => props.marginTop};
  margin-left: ${props => {props.marginLeft};
  width: ${props => {props.width};
  height: ${props => {props.height}
  border: ${props => {props.border};
  background-color: ${props => props.color};
`;

While some inputs are displaying vertically, their values appear horizontally. Is there a way to make the value display vertically as well? Here is the input:

https://i.sstatic.net/stKhx.png

I want the input value to be displayed vertically along with the adjacent text, without relying on the transform CSS attribute. Any solutions for this?

Answer №1

include the following in your CSS

  transform: rotate(90deg);
  transform-origin: center;

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

Styling Rules for WebKit Browsers

Is there a method to apply a particular CSS style for a div based on whether the user is accessing the page from a Chrome browser on a Desktop or an Android device? .myDIV{ [if CHROME???] width: 280px; [if ANDROID???] width: 100%; } Seeking guidance on ...

Extracting the console.log method from the console

Given that the console object has not been overridden and refers to a native object, the console.log method (and possibly others) is obtained from the console object with the following code: var log = obj.log = console.log; // instead of console.log.bind( ...

Displaying subtotal in a list using Vue.js and conditional rendering with v-if statement

Seeking guidance on calculating a total for a vue.js list that contains invoice items. To illustrate, let's consider a scenario where a table of invoice items is being rendered. Here is the code snippet: <table> <template v-for="(invoice_ite ...

Ways to maintain scroll position unaffected by postback?

In my JavaScript code, I have an event set to trigger at regular time intervals that clicks on a specific ASP button. This event is part of a chat room application where the gridview inside a panel needs to be refreshed frequently to display new chats. H ...

What is the method for obtaining the dynamic parent ID in Next.js?

Traditionally, we retrieve the ID from a dynamic URL. However, in this case, we want to create a nested dynamic route like someurl.com/[slug]/[id]. We have a method to get the ID, but how do we retrieve the slug? ...

jQuery show/hide functionality allows you to toggle the visibility of elements

I am looking to create a toggle button that expands the menu-wrapper width and hides the sidebar when clicked. Here is the initial CSS styling: #my-wrapper { Width:500px; } #sidebar-wrapper { width:200px; } Upon clicking the button, the CSS will update ...

Restoring styles back to the default CSS settings

I am currently working on creating visualizations using D3, and one challenge that I have encountered is the need to define a lot of styles within my code instead of in my CSS where I would prefer them to be. This necessity arises mainly to support transi ...

What is the reason for meshes rotating around their axis while Objects3D rotate around the world axis?

Consider the following code snippet: var geometry = new THREE.BoxGeometry( larguraX,altura,comprimentoZ); var material = new THREE.MeshBasicMaterial( {color: "pink"} ); var mmesh = new THREE.Mesh( geometry, material ); var objj = new THREE.Object3D( ...

Using MDBootstrap for reactjs, incorporating a modal into a table for enhanced functionality

As a newcomer to the world of React.js and Material Design Bootstrap, I am attempting to load a dataset onto a table using a mock JSON file. After some trial and error, I managed to achieve a certain level of success with this task. My goal is to include a ...

Locking the second column of a data table with CSS to prevent scrolling

We need to freeze two columns in our data table - "PPD Delivery Schedule" and "Check Opex". The first column is working fine, but we're having issues freezing the second column. We've tried various approaches but haven't been successful so ...

CSS ID selectors are not functioning properly

In my React.JS project, I am working with a div that contains a button and a list. The list is specifically identified by the id "results". return <div> <Button label="Combine Cards" disabled={!this.props.combineReady} onClick={this.handleCli ...

The @types/react-bootstrap-table2-editor package could not be located

I have been working with react-bootstrap-table2, but I am unable to install react-bootstrap-table2-editor for typescript support. I am getting an error message that says: "Could not find a declaration file for module 'react-bootstrap-table2-editor&apo ...

Finding the current location's latitude and longitude in React Native for iOS

I am struggling to retrieve the longitude and latitude as I cannot seem to access it from the default geolocation JSON object that is returned. I have followed an example from the documentation (found here) and it worked well. However, I only require the ...

Next.js is complaining that React has identified a rearrangement of Hooks despite being called from the top level

When using SWR to fetch data from my database, I encountered the following error message: Warning: React has detected a change in the order of Hooks called by OrganizationSettings. This will lead to bugs and errors if not fixed. For more information, r ...

Modify the ngb-timepicker formatting to output a string instead of an object

I am currently working on modifying ngb-timepicker so that it returns a string instead of an object. Right now, it is returning the following format: { "hour": 13, "minute": 30 } However, I want it to return in this format: "13:30" This is the HTM ...

Issue with the datepicker not toggling properly in Angular-UI 0.11.0, only opens

I am struggling with implementing 2 datepickers using Angular UI version 0.11.0. Here is my HTML code: <span ng-if="periods.period == 10"> <input type="text" datepicker-popup="dd-MMMM-yyyy" ng-model="cdate.customStartDate" is-open="opened1" ...

The CSS focus-within and hover properties are not functioning as expected

How can I make the search tags visible (the buttons above the text input field) when the search bar below them is clicked? I've tried using :hover, :focus, and :focus-within, but none of them seem to be working. Can someone help me figure out the issu ...

Performing an Ajax post request to a PHP script in order to retrieve a PHP variable using XMLHttpRequest

I am looking to dynamically update my table using JavaScript every few seconds. Currently, I have set up an AJAX post request to my update.php file and trigger it if it is set. Then, I execute a MySQL query to retrieve the data and store the resultset in ...

Tips for updating the font size of your MUI Accordion title

I was attempting to adjust the font size of the MUI-5 Accordion title. It seems like I need to override it, but I am unsure about how to do so with CSS in MUI-5. Instead of 'SX', it uses 'htmlSx'. When I tried using it, it did not produ ...

Troubleshooting: Why Laravel 5 VueJS Integration is Failing

I have recently set up a Laravel project and am attempting to integrate Vue.js into it. After running the following commands in my terminal: npm install npm run dev The commands executed without any errors. However, when I tried to import the default Vue ...