Answers for "how fit a text in the width of the container 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
2

css text to fit container

//The viewport-percentage lengths are relative to the size of the initial
//containing block. When the height or width of the initial containing block
//are changed, they are scaled accordingly.
//vw = (% of the viewport width). So using it will look like this:
p {
    font-size: 2.5vw;
}
Posted by: Guest on July-06-2020

Code answers related to "how fit a text in the width of the container css"

Browse Popular Code Answers by Language