html - css: decorating a div with ::after content without wrapping -


i've been playing around while list have main list text left aligned in content column "+" sign right aligned on same line. have working in firefox, discover lines longer single line (and therefore have ellipsis overflow) wrapping "+" sign in ie , chrome.

the example have extracted project @ https://jsfiddle.net/qo65lg2n/2/. since extract things category numbering isn't showing correctly.

is there way of approaching work in 3 major browsers?

thanks

html:

<div style="width: 1000px; text-align: center; margin: auto"> <div class="sfexpandablelistwrp">     <ol class="sflistlist">         <li class="sflistitemtitle">             <a class="sflistitemtogglelnk" href="#">                 short list title             </a>         </li>         <li class="sflistitemtitle">             <a class="sflistitemtogglelnk" href="#">                 really really really really really really really long list title             </a>         </li>         <li class="sflistitemtitle">             <a class="sflistitemtogglelnk" href="#">                             </a>         </li>     </ol> </div> </div> 

css:

.sfexpandablelistwrp {     max-width: 500px;     text-align: left; }  .sfexpandablelistwrp .sflistlist {     margin-bottom: 23px;     list-style-type: none; }  .sfexpandablelistwrp .sflistitemtitle {     font-size: 1em;     font-weight: bold;     float: left;     width: 100%;     background-color: #1bb2a0;     border-radius: 8px;     line-height: 3.7em;     margin-bottom: 1em; } /* list item toggle link */ .sfexpandablelistwrp .sflistitemtogglelnk {     padding-left: 15px;     color: white;     display: block;     white-space: nowrap;     text-overflow: ellipsis;     overflow: hidden;     padding-right: 4em; } .sfexpandablelistwrp .sflistitemtogglelnk::before {     content: "category " counter(category-counter) ": ";     color: black;     font-family: "vagroundedbt-regular";     counter-increment: category-counter; } .sfexpandablelistwrp .sflistitemtogglelnk::after {     content: "+";     color: white;     float: right;     clear: right;     font-size: 2em;     background-color: #88ceb4;     border-top-right-radius: 8px;     border-bottom-right-radius: 8px;     padding: 0 0.5em;     margin-right: -2em; } 

use position absolute may you.

  1. first,change ::after element position:absolute , delete margin-right,float attribute

    .sfexpandablelistwrp .sflistitemtogglelnk::after {     position:absolute;     top:0;     right:0;     content: "+";     color: white;     font-family: "vagroundedbt-regular";     font-size: 2em;     background-color: #88ceb4;     border-top-right-radius: 8px;     border-bottom-right-radius: 8px;     padding: 0 0.5em; } 
  2. second add position:relative parent .sflistitemtogglelnk

    .sfexpandablelistwrp .sflistitemtogglelnk {     padding-left: 15px;     color: white;     display: block;     white-space: nowrap;     text-overflow: ellipsis;     overflow: hidden;     padding-right: 4em;     position:relative; } 

i hope want


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -