Answers for "line clamp js"

4

css line-clamp

.line-clamp{
  	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	text-overflow: ellipsis;
  	overflow: hidden;
}
Posted by: Guest on September-02-2020
3

js clamp

function clamp(n, min, max) {
  if(n > max){
  	return max;
  } else if(n < min){
    return min
  } else{
  	return n;
  }
}
//clamp(202, 1,100); //returns 100
//clamp(50,1,100); //returns 50
//clamp(-3,1,100); //returns 1
Posted by: Guest on March-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language