Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

scale text in div react

import useFitText from "use-fit-text";

function name(){
  const { fontSize, ref } = useFitText({maxFontSize: 240, minFontSize: 181});

  return (
    <div ref={ref} style={{ fontSize, height: 72, width: 240 }}>
      <div id="someId">Your Text</div>
    </div>
  );
}
 
PREVIOUS NEXT
Tagged: #scale #text #div #react
ADD COMMENT
Topic
Name
5+1 =