jquery - Dot leaders with text that may wrap -
i'm trying work out how have leader between text may wrap. leader should have variable width , work when when there 1 word on either side.
here example:
lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla massa neque, laoreet @ euismod vitae, aliquet quis. ....... curabitur tellus justo, malesuada eget egestas ac, consequat sed neque.
i have tried solutions @ http://www.w3.org/style/examples/007/leaders.en.html , in other similar questions here (css dot leaders textured background & table of contents: leading dots). unfortunately none of work when both sides of text wrap.
i have fiddle http://jsfiddle.net/crstop/vkdgj/12/ closest have gotten solution. works fixed width of leader dots isn't ideal.
html:
<ul class=leaders> <li> <span>the text on left of leaders. text can rather long , may wrap line. leader should start @ end of , continue until reaches beginning of right side text</span> <span class="dotsa"></span> <span>this right side text.this text can rather long , may wrap line. </span> </li> <li><span>one</span><span class="dotsa"><span>word</span> </ul> css:
ul.leaders { padding: 0; overflow-x: hidden; list-style: none; } ul.leaders .dotsa:before { width: 0; white-space: norrmal; background: white; vertical-align: center; content:". . . . . . . . . . . . . . . . . . . . " ". . . . . . . . . . . . . . . . . . . . "; } ul.leaders span:first-child { padding-right: 0.33em; background: white; } ul.leaders span + span + span { float: right; padding-left: 0.33em; background: white; } i pure css solution i'm willing use jquery if isn't possible in css only. must work in ie8+ , ff17+
with html:
<div class="leader"> <span>peter piper picked peck of pickled peppers. peck of pickled peppers peter piper picked. if peter piper picked peck of pickled peppers, where's peck of pickled peppers peter piper picked?</span> <span>the peck of pickled peppers peter piper picked gone.</span> </div> <div class="leader"> <span>really?</span> <span>really.</span> </div> and css:
.leader { position: relative; overflow: hidden; z-index: 0; } .leader > span { background-color: white; } .leader > span:first-child:after, .leader > span:last-child:before { position: absolute; background-color: white; z-index: -1; content: "................................................................" "................................................................" "................................................................" "................................................................" "................................................................" "................................................................" "................................................................" "................................................................"; letter-spacing: 0.25em; cursor: default; } .leader > span:last-child { float: right; background-color: white; text-align: right; } .leader > span:last-child:before { left: 0; } you should have results. can play around on codepen if like.
Comments
Post a Comment