javascript - How to set icon after the last word of a text block? -
is possible set icon or whatever after last word of text block?
i want set icon after last word "nibh." bigger grey dot. tried far ::after
, different js functions either destroyed text content or dot under <div>/<p>
, not inline sentence.
.article-text:after { content: ''; display: inline-block; width: 15px; height: 15px; -moz-border-radius: 7.5px; -webkit-border-radius: 7.5px; border-radius: 7.5px; background-color: #dadada; margin: 0px 10px 0px 7px; }
<div class="article-text"> <h3>lorum ipsum</h3> <p>praesent sapien massa, convallis pellentesque nec, egestas non nisi. donec sollicitudin molestie malesuada. vivamus magna justo, lacinia eget consectetur sed, convallis @ tellus. proin eget tortor risus. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia </p> <p>curae; donec velit neque, auctor sit amet aliquam vel, ullamcorper sit amet ligula. donec rutrum congue leo eget malesuada. donec rutrum congue leo eget malesuada. mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. lorem ipsum dolor sit amet, consectetur adipiscing elit. sed porttitor lectus nibh.</p> </div>
you need change css selector .article-text p:last-child::after
because
you using
article-text
- check html elementarticle-text
not class. use.
indicate class.article-text
.since last word in
p
tag, after content of div shown in next line.use
:last-child
because have 2p
tags , want show lastp
tag
.article-text p:last-child::after { content: '.'; display: inline-block; width: 15px; height: 15px; -moz-border-radius: 7.5px; -webkit-border-radius: 7.5px; border-radius: 7.5px; background-color: #dadada; margin: 0px 10px 0px 7px; }
<div class="article-text"> <h3>lorum ipsum</h3> <p>praesent sapien massa, convallis pellentesque nec, egestas non nisi. donec sollicitudin molestie malesuada. vivamus magna justo, lacinia eget consectetur sed, convallis @ tellus. proin eget tortor risus. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia </p> <p>curae; donec velit neque, auctor sit amet aliquam vel, ullamcorper sit amet ligula. donec rutrum congue leo eget malesuada. donec rutrum congue leo eget malesuada. mauris blandit aliquet elit, eget tincidunt nibh pulvinar a. lorem ipsum dolor sit amet, consectetur adipiscing elit. sed porttitor lectus nibh.</p> </div>
Comments
Post a Comment