2339870
2339870

Reputation: 1487

Make div same height as text

I would like the div .omschrijving to have the same height as the text in it.

This is my current HTML:

<div class="aProduct">
    <div class="omschrijving">
        <span class="entry inner">
            Mundo Melocoton Short Aqua Blauw enzo bla bla bla bla bla bla bla
        </span>
    </div>
</div>

This is my CSS:

.aProduct {
    margin-bottom: 26px;
    padding-bottom: 28px;
    border-bottom: 2px solid #dcd8d7;
}

.aProduct .omschrijving {
    line-height: 26px;
    background: #cac;
    display: inline-block;
    height: auto;
}

This is the current result:

div height of text

So as you can see, when the text becomes too long, the div doesn't increase in height. Is there a way to do this?

Upvotes: 0

Views: 4068

Answers (1)

Justinas
Justinas

Reputation: 43479

Remove height attribute. This effect occurs when you specify height of element, but inner content is higher than parent.

Upvotes: 2

Related Questions