Answers for "how to make div take width according to its text"

CSS
1

stretch text to div width css

div{
  background-color:gold;
  text-align:justify;
}

span{
  background-color:red;
  width:100%;
  height:1em;
  display:inline-block;
}

<div>
  Lorem ipsum sit dolor
  <span> </span>
</div>
Posted by: Guest on April-19-2021

Code answers related to "how to make div take width according to its text"

Browse Popular Code Answers by Language