How to make vertical text using css? - html

I am expecting some thing like the below pic. But I want to add text on that vertical border.
on that border I want to add text ex: Student detail
I already saw this link.
And also I tried this below code to rotate: -90 degree
-ms-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
transform: rotate(-90deg);
It is working fine. But I want to merge those 5 points with that vertical text.
How to achieve it?. I am new to css

I think you want to do something like that >
https://codepen.io/dakata911/pen/NweMpy
/* Rotate div */
-ms-transform: rotate(270deg); /* IE 9 */
-webkit-transform: rotate(270deg); /* Chrome, Safari, Opera */
transform: rotate(270deg);

Not exactly a pure CSS solution, but it's pretty easy to get vertical text by adding line breaks, and then using pre spacing. Second example uses a bit of JS to avoid hardcoding the line breaks into the markup.
h2 {
white-space: pre;
text-align: center;
width: 40px;
background: grey;
color: white;
padding: 10px;
}
<h2>V
e
r
t
i
c
a
l
T
e
x
t
</h2>
const h2 = document.querySelector('h2')
h2.innerText = h2.innerText
.split('')
.join('\n')
h2 {
white-space: pre;
text-align: center;
width: 40px;
background: grey;
color: white;
padding: 10px;
}
<h2>Vertical Text</h2>

Related

Vertical upright text in safari has tiny spaces

When using writing-mode: vertical-lr with text-orientation: upright, all characters are about the same height. However, on Safari, the space character between words becomes very small. Here is a code snippet for demonstration:
#import url("https://fonts.googleapis.com/css2?family=Asap&display=swap");
span {
font-family: Asap, sans-serif;
text-orientation: upright;
writing-mode: vertical-lr;
-webkit-text-orientation: upright;
}
<span>Hello, World!</span>
On Chrome and Firefox it looks like this:
On Safari, however, it looks like this:
What would be the best way to make the space character the same size on all browsers that works with multiple fonts and font sizes?
You can try this, instead of using text-orientation: upright; try just rotating the text using transform: rotate(90deg);
span {
font-family: Asap, sans-serif;
transform: rotate(90deg);
}
Then target specific browsers:
span {
font-family: Asap, sans-serif;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
Here is an example in a snippet -
span {
transform: rotate(90deg);
display: block;
position: fixed;
text-transform: uppercase;
}
<span>Hello, World!</span>

input type submit value gets affected with css transform property

I am using an input type submit tag in my website. Its value attribute has "submit" text. The issue I am facing is that when I apply text transform property to input tag, the text gets italicize too. I did a little search on internet but couldn't find any luck so far. I have pasted the markup and style below.
#submit-button input[type=submit] {
background: #093f7d !important;
color: white !important;
-webkit-transform: skew(160deg);
-moz-transform: skew(160deg);
-o-transform: skew(160deg);
width: 19%;
font-size: 18px;
}
<input type="submit" value="Submit" class="wpcf7-form-control wpcf7-submit">
Just use a button and not an input. Place a span element inside the button and reverse-skew the span. I think this is your desired behaviour.
button {
background: #093f7d !important;
color: white !important;
transform: skew(160deg);
width: 19%;
font-size: 18px;
}
button span {
transform: skew(20deg);
display: block;
}
<button type="submit"><span>Submit</span></button>
Use a button instead of input type and use a o for the button text. Skew the button and unskew the text.
#btn {
background: #093f7d !important;
color: white !important;
-webkit-transform: skew(160deg);
-moz-transform: skew(160deg);
-o-transform: skew(160deg);
width: 19%;
font-size: 18px;
}
#btn-text {
-ms-transform: skewX(-160deg); /* IE 9 */
-webkit-transform: skewX(-160deg); /* Safari */
transform: skewX(-160deg);
padding: 5px;
}
<button id="btn"><div id="btn-text">Submit</div></button>

How can i rotate a title 270 degrees?

I have a website which i want to rotate a title 270deg on! I have seen many other posts about this but they don't seem to be working for me! Below is the code of the item i want to rotate! Where do i put the code and what do i put?
I want to put it in this code! This is the whole segment for that text!
/* LOGO CSS*/
#logo_index_text a,
#logo_index_left a,
.logo_permalink_page
{
font-weight: {text:Weight Logo Index};
font-family: {font:Font Logo};
color: {color:Text Logo};
}
#logo_index_left{left:{text:Position Logo Left}}
#logo_index_left {top:{text:Position Logo Top}}
#logo_index_text a,
#logo_index_left a
{
letter-spacing: {text:LetterSpacing Logo};
font-size: {text:FontSize Logo Index};
line-height: {text:LineHeight Logo}
}
{block:IfNotLogoOpacityonHover}
#logo_index_text a:hover,
#logo_index_left a:hover{
opacity: 1 !important}
{/block:IfNotLogoOpacityonHover}
.logo_permalink_page{font-size: {text:FontSize Logo Perma}}
The code i have tried is:
-moz-transform: rotate(270deg);
-moz-transform-origin: 50% 50%;
-webkit-transform: rotate(270deg);
-webkit-transform-origin: 50% 50%;
and
-moz-transform: rotate(7.5deg); /* FF3.5+ */
-o-transform: rotate(7.5deg); /* Opera 10.5 */
-webkit-transform: rotate(7.5deg); /* Saf3.1+, Chrome */
and
-webkit-transform: rotate(320deg);
-moz-transform: rotate(320deg);
-o-transform: rotate(320deg);
Thanks for the help in advance! :)
Here is the simplest place to start. To me your main logocss seems a bit of a mess, but bear in mind you need to have display: block for anything to rotate.
Fiddle: http://jsfiddle.net/jjBGz/3/
Beneth's method won't work if you have a background...
Here's the real trick:
The secret is having vertical-lr set on the original element, so width and height are already correct.
Then all you have to do is rotate the text 180 degrees with transform-origin center...
Works in Chrome and Firefox and IE 11 & 10 (according to MDN backwards-compatible to IE9, but since ms-transform-rotate doesn't work properly, it degrades gracefully to only writing-mode vertical-lr in IE9, if you omit ms-transform).
https://developer.mozilla.org/en-US/docs/Web/CSS/text-orientation
https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode#Browser_compatibility
https://msdn.microsoft.com/en-us/library/ms531187(v=vs.85).aspx
Example:
.blackhd
{
vertical-align: bottom;
width: 40px;
#height: 100px;
border: 1px solid hotpink;
background-color: black;
text-align: center;
}
.vert
{
display: inline-block;
color: white;
#font-weight: bold;
font-size: 15px;
writing-mode: vertical-lr;
#writing-mode: vertical-rl;
-ms-writing-mode: tb-rl;
transform-origin: center;
transform: rotate(180deg);
padding-top: 2mm;
padding-bottom: 3mm;
}
<table>
<tr>
<td class="blackhd"><span class="vert">abc</span></td>
<td class="blackhd"><span class="vert">defghijkl</span></td>
</tr>
<tr>
<td>abc</td>
<td>defghijklmnopqr</td>
</tr>
</table>

How to add a rotated image in CSS?

I have written below code. But now the requirement is that the image should be rotated 180 degrees. How can I achieve this?
#cell {
background-image: url("../images/logo.PNG");
background-attachment: fixed;
background-repeat: no-repeat;
background-position: 0px 250px;
background-color: #FFFFFF;
border-left: 2px;
}
HTML tag:
<td width="2%" id="cell"/>
One cross-browser solution is
#cell {
-webkit-transform: rotate(180deg); /* Chrome and other webkit browsers */
-moz-transform: rotate(180deg); /* FF */
-o-transform: rotate(180deg); /* Opera */
-ms-transform: rotate(180deg); /* IE9 */
transform: rotate(180deg); /* W3C compliant browsers */
/* IE8 and below */
filter: progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=0, M21=0, M22=-1, DX=0, DY=0, SizingMethod='auto expand');
}
Note, that for IE8 and below, the rotation center point is not located in the center of the image (as it happens with all other browsers). So, for IE8 and below, you need to play with negative margins (or paddings) to shift the image up and left.
The element needs to be blocked. Other units that can be used are:
180deg = .5turn = 3.14159rad = 200grad
If you don't have any text in the <td> you can use transform: rotate(180deg); on it. If you do have text, this will rotate the text too. To prevent that you can put a <div> inside the <td>, put the text inside that, and rotate that 180 degrees (which puts it upright again).
Demo: http://jsfiddle.net/ThinkingStiff/jBHRH/
HTML:
<table>
<tr><td width="20%" id="cell"><div>right-side up<div></td></tr>
</table>
CSS:
#cell {
background-image: url(http://thinkingstiff.com/images/matt.jpg);
background-repeat: no-repeat;
background-size: contain;
color: white;
height: 150px;
transform: rotate(180deg);
width: 100px;
}
#cell div {
transform: rotate(180deg);
}
Output:
You can also try this axial type rotation OR rotation on Z-axis.
.box {
background: url('http://aashish.coolpage.biz/img/about/7.jpg');
width: 200px;
height: 200px;
transition: transform .5s linear;
transform-style: preserve-3D;
}
.box:hover {
transform: rotateY(180deg);
}
<div class="box"></div>
You can use CSS3 for this, but there are some browser issues:
transform: rotate(180deg);
Also look here: CSS3 rotate alternative?

Does unicode or HTML have a vertical double guillemet (chevron)?

Does anybody know if there's a double chevron symbol in unicode/HTML-space similar to the double guillemet represented by » (»)?
In other words, I'm trying to avoid using an image if I can get by with text, but I need something like this:
It's the double chevron I can't seem to figure out. Looks like graphics for me it is.
May be this site will help you http://shapecatcher.com/ , very useful!
︽ U+FE3D PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET
︾ U+FE3E PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET
These require a Chinese or Japanese font though.
I can't give you the character entity that you want, but it's possible to effect an...alternative, and still not use images (though it does require that the text itself be wrapped in an element, in this case span):
<span class="shadowed">^</span>
<span class="rotated">»</span>
CSS:
span { /* this is all, pretty much, just for the aesthetics, and to be adapted */
margin: 0 auto 1em auto;
font-family: Helvetica, Calibri, Arial, sans-serif;
font-size: 2em;
font-weight: bold;
color: #000;
background-color: #ffa;
display: block;
width: 2em;
height: 2em;
line-height: 2em;
border-radius: 0.5em;
text-align: center;
}
span.shadowed {
text-shadow: 0 0.5em 0 #000;
}
span.rotated {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
JS Fiddle demo.
The above span.rotated section, for IE < 10 compatibility (using filters, whereas IE 10 (or possibly 9) would/should use the -ms-transform or, simply, transform CSS3), using a filter approach:
span.rotated {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
/* IE < 10 follows */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}​
JS Fiddle demo (works in IE 7/XP, other versions I'm unable to test).
There's a problem with rotation. If you apply rotation(90deg) and rotation(-90deg) to two separate » you'll see that their position changes. A hacky way to fix it is to apply direction: rtl like this:
http://codepen.io/tomasz86/pen/lmCaL