Reputation: 121
I have this Japanese text segmented into <span>
s. In the images below I added red borders to the spans to illustrate the problem. The vertical text is achieved using the writing-mode: vertical-rl;
CSS property on the surrounding div.
As you can see the text inside centred inside each span either having a gap left or at the top. Or in the case of Android it doesn't even seem to put each character inside of a square. Is there a way to ensure each character is perfectly centred inside of the <span>
s?
Example HTML file:
<!DOCTYPE html>
<html lang="ja">
<style>
span {
border: 1px solid red;
text-align: center;
}
</style>
<body>
<div>
<span>一</span><span>+</span><span>三</span><span>*</span><span>九十</span>
</div>
<br>
<div style="writing-mode: vertical-rl">
<span>一</span><span>+</span><span>三</span><span>*</span><span>九十</span>
</div>
</body>
</html>
Result seems to depend on the browser!
Upvotes: 2
Views: 562
Reputation: 417
It would be more helpful if I could see the CSS code, but try using the text-align
CSS property if you haven't yet.
You can use it like this: text-align: center;
span {
border: 1px solid red;
text-align: center;
font-size: 30px;
}
<!DOCTYPE html>
<html lang="ja">
<body>
<div>
<span>一</span><span>+</span><span>三</span><span>*</span><span>九十</span>
</div>
<br>
<div style="writing-mode: vertical-rl">
<span>一</span><span>+</span><span>三</span><span>*</span><span>九十</span>
</div>
</body>
</html>
Upvotes: 2
Reputation: 67
You should look at this post. Try padding-right
or text-align: center
on the CSS. I could probably tell you what is is if I saw the code.
Upvotes: 0