jQuery的垂直文本 [英] Vertical Text with jQuery

查看:72
本文介绍了jQuery的垂直文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过使用jQuery在字符之间添加<br />标签来垂直对齐文本.

I'm looking to vertically align text by adding <br /> tags between characters with jQuery.

<div id="foo"><label>Vertical Text</label></div> 

看起来像这样:

V
e
r
t

c
a
l

T
e
x
t

V
e
r
t
i
c
a
l

T
e
x
t

推荐答案

我们去打高尔夫球吧!

$('#foo label').html($('#foo label').text().replace(/(.)/g,"$1<br />"));

完全未经测试,但是正则表达式中的模式看起来像个胸部.

Completely untested, but the pattern in the regex looks like a boob.

这篇关于jQuery的垂直文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆