If I define a heading like , its width is set to 100% by default.
Is there a way to make sure its width is set to the smallest value possible
Instead of display: inline, give it display: inline-block. This will retain the block-like qualities of the h1 tag, except for the 100% width.
display: inline
display: inline-block