I would like to know how to resize the size of a div according to the width of the text, avoiding this wasted space, leaving the div compressed. Example:
The div should receive a cut such as:
Example code:
.linhaCodigo{
  background: #C0C0C0;
  position: relative;
}<div class="conteudo2">
              <h3>Cap 2 - Title</h3>
              <p align="left"><h4 align="left"><b>Title 2:</b></h4>
                textexttexttexttexttexttexttexttexttexttexttexttext
              </p>
              <div class="linhaCodigo"> print("I like it!")<br>
                <b>Outup:</b><br>
                I like it!
              </div><br>
            </div> 
     
    