CSS side tag problem.

From C++ to PHP, debugging to webhosting; help and discussion about writing your latest program to running your website. NOT for help when your PC won't work.

Announcements Posted on
TSR launches Learn Together! - Our new subscription to help improve your learning 16-05-2013
Sign in to Reply
  1. JAlexander91's Avatar
    • Junior Member
    • Posts: 58
    CSS side tag problem.
    I'm trying to create a side tag, as found here in it basic form. http://www.firstforturf.co.uk/quotation.php

    I'm trying to do as much of it as possible using CSS rather than just putting in an image however I've encountered a problem.

    Upon rotating the side DIV it is moved from the side of the page. I've tried setting the margin to 0 but it doesn't seem to be working.

    If it helps, here are the CSS rules for sidetag.

    color: #FFF;
    height: 50px;
    width: 200px;
    position: fixed;
    background-color: rgb(0,102,204);
    font-size: 32px;
    line-height: 50px;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    text-align: center;
    top: 50%;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    writing-mode: tb-rl;

    Greatful if anyone could help. Cheers.
  2. Vulpes's Avatar
    • PS Helper
    • TSR Demigod
    Re: CSS side tag problem.
    (Original post by JAlexander91)
    I'm trying to create a side tag, as found here in it basic form. http://www.firstforturf.co.uk/quotation.php

    I'm trying to do as much of it as possible using CSS rather than just putting in an image however I've encountered a problem.

    Upon rotating the side DIV it is moved from the side of the page. I've tried setting the margin to 0 but it doesn't seem to be working.

    If it helps, here are the CSS rules for sidetag.

    color: #FFF;
    height: 50px;
    width: 200px;
    position: fixed;
    background-color: rgb(0,102,204);
    font-size: 32px;
    line-height: 50px;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    text-align: center;
    top: 50%;
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    writing-mode: tb-rl;

    Greatful if anyone could help. Cheers.
    Do:
    Code:
    position: fixed;
    top: 50%;
    left: 0px;
    or

    Code:
    left: -150px;
    Not sure what you want exactly ^

    Last edited by Vulpes; 25-07-2012 at 01:34.
  3. JAlexander91's Avatar
    • Junior Member
    • Posts: 58
    Re: CSS side tag problem.
    Sorry, didn't work. Anyone else?
  4. Dez's Avatar
    • TSR Group Staff
    • The square root of rope is string.
    • Location: The South
    • Posts: 8,154
    Re: CSS side tag problem.
    Either add a translation into your transform:

    Code:
    -moz-transform: rotate(90deg) translate(0px, 75px);
    -o-transform: rotate(90deg) translate(0px, 75px);
    -webkit-transform: rotate(90deg) translate(0px, 75px);
    transform: rotate(90deg) translate(0px, 75px); /* (width/2) - (height/2) */
    Or change the origin, and add a negative margin to compensate:

    Code:
    margin-top: -100px; /* width/2 */
    -moz-transform-origin: -25px center;
    -o-transform-origin: -25px center;
    -webkit-transform-origin: -25px center;
    transform-origin: -25px center; /* -(height/2) */
    Or simply shift the position of the element:

    Code:
    left: -75px; /* (width/2) - (height/2) */
    Last edited by Dez; 25-07-2012 at 14:03.
Sign in to Reply
Share this discussion:  
Useful resources
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.