1

so I have this problem where I rotate my text to 90deg, but the margin are still the same as the original (where I havent rotated the text)

Original (No rotate)

After rotate

The margins after I rotated the image stay the same. ( I want the margins to follow the new orientation which I rotated the text )

(I put red outline so it can be seen better.)

Also, if its possible can I make the red outline to fill the white in the left? (I tried using padding but it doesn't work as the way I want)

Here is the code

<script src="https://kit.fontawesome.com/2c7037d9e8.js" crossorigin="anonymous"></script>
<div class='color-pick'>
    <div class='color-pick-text'>
        Colors <i class="fas fa-caret-down"></i>
    </div>
    <div class='color-pick-box'>
        <div class='color-opt color-red'></div>
        <div class="color-opt color-orange"></div>
        <div class="color-opt color-yellow"></div>
        <div class="color-opt color-green"></div>
        <div class="color-opt color-blue"></div>
        <div class="color-opt color-indigo"></div>
        <div class="color-opt color-purple"></div>
        <div class="color-opt color-lime"></div>
        <div class="color-opt color-pink"></div>
        <div class="color-opt color-silver"></div>
        <div class="color-opt color-custom"></div>
    </div>
</div>

and the css :

.color-pick-box{
    background-color:#4c4c47;  
    display:flex;
    width:150px;
    flex-wrap: wrap;
}
.color-pick{
    border:1px solid blue;
    display:inline-flex;
    align-items: center;
    overflow:hidden;
}

.color-pick-text{
    text-align:center;
    border:1px solid red;
    transform:rotate(90deg);
 }

.color-opt{
    margin:5px;
    height:20px;
    width:20px;
    border-radius:50%;
}

.color-pick .fas{
    display:inline;
}

.color-red{
    background:red;
}
.color-orange{
    background:orange;
}
.color-yellow{
    background:yellow;
}
.color-green{
    background:green;
}
.color-blue{
    background:blue;
}
.color-indigo{
    background:indigo;
}
.color-purple{
    background:purple;
}
.color-lime{
    background:lime;
}
.color-pink{
    background:pink;
}
.color-silver{
    background:silver;
}
.color-custom{
    background: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);
}

Thank you! Sorry for my bad English

1 Answers1

1

I tried like this. And it worked.

.color-pick-text{
    text-align:center;
    border:1px solid red;
    writing-mode: vertical-lr;
}
Sato Takeru
  • 1,669
  • 4
  • 12
  • 27