Answers for "how to limit span characters in html"

1

span limit text length

<style>
	.text {
  		display: block;
  		width: 100px;
  		overflow: hidden;
  		white-space: nowrap;
  		text-overflow: ellipsis;
	}
</style>
<span class="text">Hello world this is a long sentence</span>
Posted by: Guest on December-14-2020
0

limit characters displayed in span

$(document).ready(function(){
  
  $('.txtReduce').each(function (f) {

      var newstr = $(this).text().substring(0,20);
      $(this).text(newstr);

    });
})


in HTML : 
<span class="txtReduce" th:maxlength="20"
Posted by: Guest on March-30-2021

Code answers related to "how to limit span characters in html"

Browse Popular Code Answers by Language