I am making a website and want the first word in my title/h1 tag to be read horizontally and the second word to be read vertically.
I tried using span tags in my h1 but it would only let my change the color and would not work when I used the rotate feature.
html
<h1>
<span class="horizontal-QuanT">QuanT</span>
<span class="verticle-Tech">Tech</span>
</h1>
css
h1{
color:bisque;
text-align: center;}
h1 span.horizontal-QuanT{
color:gray}
h1 span.verticle-Tech{
color:white;
rotate: 90deg;}
2
Answers
Inline elements can’t be rotated, so you need to set
display: inline-block;
on the vertical span. Also, the correct syntax for rotating istransform: rotate(90deg);
.Since you have really kind of gotten away from the semantic meaning of the tags I would suggest you just use three div styled as a grid and give yourself full control of the style without working around the CSS of an
h1
tag.Feel free to change margins padding etc. to set each part where you want including the size of the header container.
Note: I did NOT use the tags like div, span etc. in the CSS as I consider that a bad practice so you can change the element tag without also needing to change the CSS.