Element not sticking in place
Clash Royale CLAN TAG#URR8PPP
Element not sticking in place
I have a title, that I want to be vertical rather than horizontal. With the CSS I've used it does flip it horizontally but it creates a separate border box.
Like so:
#scheduled2
transform: rotate(270deg);
position: relative;
top: 300px;
background-color: darkgray;
font-size: 14px;
th
border: 1px solid lightgray;
padding: 12px;
<table>
<tr>
<th id="scheduled2">Scheduled Volumes</th>
</tr>
<tr>
<th id="manning2">Manning Volumes</th>
</tr>
</table>
If I use float: right, it fixes the problem but causes a new problem of the title element to not stay in the right place when the screen is a different size. I can get it to stay in place when the float isn't added but then it's separated, like in the image.
I've added the HTML to the question.
– L.C
Aug 8 at 13:59
jsfiddle.net/uwk7Lmgo/2 - on the fiddle, I don't have the issue
– L.C
Aug 8 at 14:04
@L.C that means some other style is affecting your component, please do have a look at your CSS
– weBBer
Aug 8 at 14:14
I've realised theres a contradictory of the code with the th css, that I've added to the question. When I took away the border it worked but then the element isn't looking nice
– L.C
Aug 8 at 14:43
2 Answers
2
try to use this css:
writing-mode: vertical-rl;
text-orientation: mixed;
or try to put your text into <p></p>
<p></p>
<table>
<tr>
<th><p id="scheduled2">Scheduled Volumes</p></th>
</tr>
<tr>
<th id="manning2">Manning Volumes</th>
</tr>
</table>
hope it helps :)
----EDIT----
You can try to change table th to divs
<div class="border" id="scheduled2">Scheduled Volumes</div>
<div class="border" id="manning2">Manning Volumes</div>
and css:
#scheduled2
transform: rotate(270deg);
position: relative;
top: 300px;
background-color: darkgray;
font-size: 14px;
.border
border: 1px solid lightgray;
padding: 12px;
That hasn't worked sadly. It displays the whole element horizontally but it's no longer seperated.
– L.C
Aug 8 at 14:24
You can remove table and put it into two divs with border.
– Dima Vizelka
Aug 8 at 14:49
I've solved the problem.
The CSS code for th was contradicting the code for scheduled2, so I moved that code from th and added it to scheduled2. So with this CSS, I've managed to get the text verticle and in the right place on the screen and it no longer moves.
CSS:
#scheduled2
transform: rotate(270deg);
float: right;
position: relative;
top: 1340px;
left: 250px;
background-color: darkgray;
font-size: 14px;
border: 1px solid lightgray;
padding: 12px;
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
can you give us the html as well so we can test it, a codepen or a jsfiddle?
– Torjescu Sergiu
Aug 8 at 13:58