Bryan
Bryan

Reputation: 63

Word-wrap: break-word does not work with a very long word combined with width: 100%

Why is it in this fiddle https://jsfiddle.net/0h1wbju0/ my word-wrap: break word and width: 100% aren't being respected and the long word is not being broken up into multiple lines to fit inside it's parent div? Thanks!.

HTML:

    <div class="first_div">
        <fieldset class="fieldset_description"><label>Description</label>
            <div data-id="description"> fdsjalllffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff</div>
        </fieldset>
    </div>

CSS:

.first_div {
  width: 200px;
}

.fieldset_description {
  max-width: 100%;
  word-wrap: break-word;
}

.description {
  max-width: 100%;
  word-wrap: break-word;
}

Upvotes: 4

Views: 509

Answers (1)

Bandi
Bandi

Reputation: 103

you should use =>

`word-break: break-all;`

Working code jsfiddle

Upvotes: 3

Related Questions