[Solved] How do I constrain the width of a html element to the content of said element? [closed]
[ad_1] I’m assuming you’re saying that you only want the H1 element to be as wide as the text within it. If that’s the case, you need to set display: inline;. h1 { margin: auto auto 10px 10px; padding-left: 6px; border-bottom: 4px outset #227777; box-shadow: 0px 3px 10px black; display: inline; } <div> <h1>Heading</h1> </div> … Read more