how to make width as per content for a block element code example Example: make div the size of the text inside div { display: inline-block; }