Solved

Input box with rotated labels

Posted on 2013-06-03
5
411 Views
Last Modified: 2013-06-03
Hi

I have a unordered list of input boxes how can I rotate the labels like an excel spreadsheet

Bellow is some rough code but all this dose is put the boxes inline not rotate the labels, as can be seen the input will only contain one character so the labels will be longer, and need to be in a row.

CSS
.rotate  
{
display: inline;
list-style-type: none;
padding-right: 20px;
}

HTML
<div>
  <ul class = "rotate">
    <li> <input type="text" size ="2" id="one" value="X"><label for="one">label one</label></li>
    <li> <input type="text" size ="2" id="one" value="Y"><label for="two">label two</label></li>
    <li> <input type="text" size ="2" id="one" value="Z"><label for="three">label three</label></li>
  </ul>
</div>

Open in new window

0
Comment
Question by:trevor1940
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39216059
This is the basic css code to rotate but you have to convert the label to a block and fix  your html code to be valid.


  -ms-transform:rotate(270deg); /* IE 9 */
  -moz-transform:rotate(270deg); /* Firefox */
  -webkit-transform:rotate(270deg); /* Safari and Chrome */
  -o-transform:rotate(270deg); /* Opera */

Open in new window

Working Sample http://jsbin.com/ulosop/2/edit
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <style>

.rotate  
{

list-style-type: none;

}
    
    
    label{
      display:Block;
      width:30px;
  -ms-transform:rotate(270deg); /* IE 9 */
  -moz-transform:rotate(270deg); /* Firefox */
  -webkit-transform:rotate(270deg); /* Safari and Chrome */
  -o-transform:rotate(270deg); /* Opera */
    }
    
</style>
</head>
<body>
  <div>
  <ul class = "rotate">
    <li><label for="one"><input type="text" size ="2" id="one" value="X">one</label></li>
    <li><label for="two"> <input type="text" size ="2" id="two" value="Y">label two</label></li>
    <li><label for="three"> <input type="text" size ="2" id="three" value="Z">label three</label></li>
  </ul>
</div>
  

  
 
</body>
</html>

Open in new window

0
 
LVL 1

Author Comment

by:trevor1940
ID: 39216147
that looks good

apologies for any typos in my code example

if i wanted the output similar to the attached bmp (with out the excel numbering) should i use a table?Required output
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39216196
Yes, I think in this case that would be easier.   This is what tables are designed for.
http://jsbin.com/ayurod/1/edit

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
 <style>
   table{background-color:blue;color:gold;}
      th{
      
     height:60px;
     padding-bottom:10px;
     
  -ms-transform:rotate(270deg); /* IE 9 */
  -moz-transform:rotate(270deg); /* Firefox */
  -webkit-transform:rotate(270deg); /* Safari and Chrome */
  -o-transform:rotate(270deg); /* Opera */
    }
   
   td{background-color:gray;}
  </style>
</head>
<body>
  <table width="400">
  <tr>
    <th>heading 1</th>
    <th>heading 2</th>
    <th>heading 3</th>
  </tr>
  <tr>
    <td>item 1.1</td>
    <td>item 1.2</td>
    <td>item 1.3</td>
  </tr>
  <tr>
    <td>item 2.1</td>
    <td>item 2.2</td>
    <td>item 2.3</td>
  </tr>
    </tr>
  
</table>
</body>
</html>

Open in new window

0
 
LVL 1

Author Closing Comment

by:trevor1940
ID: 39216503
Thanx
btw I'm converting excel spredsheet into a Database with a web front end  this part just contains a single letter which the user may alter
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39216634
If you are not using this for a public website you could might be able to get away with saving your excel as html and trying that.  However, the html microsoft produces works great for printing but terrible for the web.  I think it may be fine where you are sharing with just a few people and it may or may not work.  But if meant for the general public, this is a better solution.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question