Vertical upright text in safari has tiny spaces - html

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>

Related

Unable to rotate copyright (©) character

I can't rotate © character. Is there something I'm doing wrong?
.copy {
font-size: 12px;
font-family: Arial;
writing-mode: vertical-rl;
text-orientation: mixed;
transform: rotate(180deg);
}
<span class="copy">© This is not working.</span>
<span class="copy">& This is working.</span>
You should use this :
sideways
Causes characters to be laid out as they would be horizontally, but with the whole line rotated 90° clockwise.
.copy {
font-size: 12px;
font-family: Arial;
writing-mode: vertical-rl;
text-orientation: sideways-right;
transform: rotate(180deg);
}
<span class="copy">© This is not working.</span>
<span class="copy">& This is working.</span>
EDIT - You could use sideways-right since there aren't many browsers supporting sideways - they both work for me
EDIT 2 -
sideways-right
An alias to sideways that is kept for compatibility purposes.
But both actually seems supported by most major browsers
You can rotate the text with only transform, it's supported in all major browsers even old IEs.
.copy {
font-family: sans-serif;
display: inline-block;
transform: rotate(-90deg) translate(-100%, 100%);
transform-origin: left bottom;
}
<span class="copy">© Hello World</span>

How to make vertical text using css?

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>

Turning a letter in a sentence without the text separating into different lines

I have a sentence where I would like to turn a letter, but cannot seem to do so without the text separating into different lines. Managed to turn it with the use of a h1 and h2 but that gave me the problem of it separating into different lines I was more thinking something like this :
h1 {
font-family: "Gill Sans", Arial, sans-serif;
font-size: 150%;
text-transform: uppercase;
letter-spacing: 0.2em;
}
.rotate {
-moz-transform: scale(-1, 1);
-webkit-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
<div id="toptext">
<h1> T<span class="rotate">E</span>XT TEST </h1>
</div>
But this is not working.
Assuming you mean flip (around the letter's vertical axis) rather than 'rotate/turn'.
As stated, transforms do not work on inline elements so we change the display to `inline-block. I added a minor translation to account for the letter spacing / layout differences.
h1 {
font-family: "Gill Sans", Arial, sans-serif;
text-transform: uppercase;
letter-spacing: 0.2em;
text-align: center;
font-size: 72px;
}
.rotate {
display: inline-block;
transform: translateX(-.2em) scale(-1, 1);
}
<div id="toptext">
<h1> T<span class="rotate">E</span>XT TEST </h1>
</div>
Use span to separate each letter and in your CSS use
h1 span{
display: inline-block;
transform: rotate(90deg);
-moz-transform: rotate(90deg);/* for Mozilla */
-webkit-transform: rotate(90deg);/* for Chrome and Safari */
}
Use rotate in your transform:
.rotate {
display: inline-block;
transform: rotate(90deg);
}
Adjust the rotation to your liking. I used a display as well, as you noticed. As per the spec, you can't use transform on inline elements.

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>

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