MDeuerlein
MDeuerlein

Reputation: 700

Set the width of a DIV depending on content in Foundation 5

I want the width of a DIV only to be as wide as the content is and not fullwidth inside the parent DIV.

Example:

<div class="row">
    <div class="small-7 columns">
        <div class="mycontent> CONTENT </div>
    </div>
</div>

The width of "mycontent" is always 100% of the Available width inside "small-7 columns". How can I set the width of DIV to be only as wide as in this Example the word "CONTENT".

Upvotes: 0

Views: 71

Answers (2)

tommymcdonald
tommymcdonald

Reputation: 1582

You could set the "mycontent" class to display:inline-block;. Divs are block level elements and will naturally span the full width of the parent container.

Upvotes: 1

vico
vico

Reputation: 2142

.mycontent{ display: inline; }

or

.mycontent{ display: inline-block; }

depending on how you want it to look like

Upvotes: 1

Related Questions