从下到上换行文本 [英] Wrap text from bottom to top

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

问题描述

有人知道我如何以相反的顺序从下到上包装文本吗?我附上了一个示例图片.

Anybody know how I could wrap the text in reverse order, from bottom to top? I attached an example image.

[][http://i.stack.imgur.com/RVsIG.jpg]

与其在线已满后断线并在最后有一条不完整的线,我需要从下到上以某种方式刹车,因此底线已满而顶线不完整.

Instead of breaking the line after it is full and having an incomplete line at the end, I need to brake somehow from bottom to top, so bottom lines are full and top line is incomplete.

推荐答案

我不建议使用甚至在 Chrome & 中都没有的奇异 CSS 属性.火狐还没有.最好的跨浏览器解决方案是在文档加载时在 Javascript 中处理此问题.这是如何做到这一点的草图:

I would not recommend using exotic CSS attributes which aren't even in Chrome & Firefox yet. The best cross-browser solution is to handle this in Javascript when the document loads. Here's a sketch of how to do that:

$(function() {
    $(".title").each(function(i,title) {
        var width = 0;
        var originalHeight = $(title).height();
        var spacer = $('<div style="float:right;height:1px;"/>').prependTo(title);
        while (originalHeight == $(title).height()) {
            spacer.width( ++width );
        }
        spacer.width( --width );
    });
});

工作 JSFiddle 在这里:http://jsfiddle.net/zephod/hfuu3m49/1/

Working JSFiddle is here: http://jsfiddle.net/zephod/hfuu3m49/1/

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

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