solvit.io

Make a <div> as wide or narrow as its contents

Solution

Apply the display: inline-block style to the parent <div> element.

Example
<div id="parent">
    <a href="#">Return to homepage</a>
</div>
#parent {
    display: inline-block;
}
Find more solutions about: ,