1

How can I use CSS to make the font size of text as big as possible but only wrap twice?

Example of what I mean: I'd like to turn this:

img1

into this:

img2

Here is the sample code I'm working with:

<style>
div{
   width:250px;
   height:125px;
   padding:10px;
   background-color:yellow;
   border:1px solid black;
}
</style>
</head>
<body>
<div>How can I make this text wrap only twice (has two lines) while also making the font size as large as possible?</div>
</body>
mcool
  • 457
  • 4
  • 29
  • 3
    you can't do this in css – you will need some java script to achieve this. See this example [Font Size scaling depending on length of the text and parent div](https://stackoverflow.com/questions/73471477/font-size-scaling-depending-on-length-of-the-text-and-parent-div/73521357#73521357) – herrstrietzel Oct 05 '22 at 17:10

0 Answers0