使用jquery / JS / CSS如何将单词附加到句子中,以便逐句推送句子

时间:2013-07-07 07:31:47

标签: javascript jquery css text append

而不是从左到右,我喜欢被追加的句子,从右向左移动,同时被向上推。查看我更新的fiddle;)...

                                      <-- Essentially I want the words to just get pu
-shed in this direction <------------------------------------------------------------
------- <-- as I continue to append more and more words to the end of this #span. Like 
a screw just being unscrewed...?   

2 个答案:

答案 0 :(得分:2)

您可以在段落中使用元素divdiv应该有widthleft-margin

它看起来像http://jsfiddle.net/wmqFL/3/。如果您愿意,可以动态地创建div

答案 1 :(得分:0)

只需将其添加到p(CSS): -

p {
    text-align:right;
}

HTML: -

<button id="Append">Add Text</button>

<p>This is a paragraph</p>

JQUERY: -

$(document).ready(function(){
  $("#Append").click(function(){
    $("p").append("<span> Word </span>");
  });
});

选中此FIDDLE