div width be the same as its content code example
Example 1: div not larger than its content
The solution is to set your div to display: inline-block.
Example 2: make div the size of the text inside
div {
display: inline-block;
}
The solution is to set your div to display: inline-block.
div {
display: inline-block;
}