Log in

View Full Version : Resolved Rotating Text



Deadweight
03-01-2014, 01:37 PM
I'm currently rotating text [Currently in webkit browsers only for this test] but it seems like i am doing something totally wrong. I cant seem to get the 'div' inside the 'li'.

Here is my code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rotation</title>
<style>
* { padding:0; margin:0 auto;}
li { list-style:none;}

.rotate { width: 90%;}
.rotate>li {
width:20px;
height:300px;
float:left;
border:1px solid black;
}
.rotate>li:first-child {
border-left:1px solid black;
}
.r {
height:20px;
width:300px;
-webkit-transform:rotate(-90deg);
border:1px solid red;
}

.spacer {clear:both}
</style>
</head>
<body>
<div>
<ul class="rotate">
<li><div class="r">Group 1</div></li>
</ul>
<div class="spacer"></div></div>
</body>
</html>


As you will notice the red box is suppose to be in the black box. Any idea how to fix this?

coothead
03-02-2014, 12:52 AM
Hi there Crazykld69,


try it like this...


<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">

<title>Rotation</title>

<style>
* {
padding:0;
margin:0;
list-style-type:none;
}
body {
background-color:#f0f0f0;
}
#rotate {
/*
the width value is the li element's overall width
- ( width, padding, margin and border ) -
multiplied by the actual number of li elements
*/
width:336px;
padding:4px 0 4px 4px;
margin:20px auto;
border:1px solid #999;
border-radius:13px;
background-color:#fff;
overflow:hidden;
box-shadow:8px 8px 8px #999;
}
#rotate li {
float:left;
width:32px;
height:302px;
padding:2px;
margin-right:4px;
border:1px solid #000;
border-radius:8px;
}
.r {
line-height:30px;
width:300px;
margin-top:2px;
border:1px solid #f00;
border-radius:5px;
background-color:#fee;
-webkit-transform-origin:150px 150px;
transform-origin:150px 150px;
-webkit-transform:rotate(-90deg);
transform:rotate(-90deg);
text-indent:20px;
box-shadow:inset 0 0 10px #666;
}
</style>

</head>
<body>

<ul id="rotate">
<li><div class="r">Group 1</div></li>
<li><div class="r">Group 2</div></li>
<li><div class="r">Group 3</div></li>
<li><div class="r">Group 4</div></li>
<li><div class="r">Group 5</div></li>
<li><div class="r">Group 6</div></li>
<li><div class="r">Group 7</div></li>
<li><div class="r">Group 8</div></li>
</ul>

</body>
</html>

The code has been tested in...

IE11
Firefox 27.0.1
Chrome 33.0
Opera 12.16
Opera 19.0
Safari 5.1.7



coothead

Deadweight
03-02-2014, 01:46 AM
That is perfect thanks so much

coothead
03-02-2014, 01:56 AM
No problem, you're very welcome. ;)


coothead