Skip to content Skip to sidebar Skip to footer

Is It Possible To Extend A H2 Box In Css Depending On The Text Within It?

I have a header box appearing on a page. I am using h2 and configured this to show a border etc. My issue is that the longest text requires a box of 400px wide, whereas the shortes

Solution 1:

Try this

div{
    float: left;
    width: auto;
    background-color: #777;
}

DEMO

Solution 2:

yes you can apply float: left to H2

Post a Comment for "Is It Possible To Extend A H2 Box In Css Depending On The Text Within It?"