I am currently developing a shopping list app and everything is running smoothly. However, I am encountering an issue with breaking a long string into the next line. Even though I tried using word-wrap, it doesn't seem to work as intended.
For example, when inputting a very long word like
(Helooooooooooooooooooooooooooooooo)
, I would like it to break the word and display it on the next line like
(Helooooooooooooooo
oooooooooooooooooooo)
This is what my HTML looks like:
<div id="container">
<input id="add" type="text" placeholder="Type new item here"
autocomplete="off" autofocus/>
<ul id="item_list">
<li id="base" class="hidden">
<input class="check" type="checkbox"> <span class="item">Item</span>
<button class="delete_item hidden"></button>
</li>
</ul>
</div>
And this is the corresponding CSS code:
.item {
font-size: 15px;
/* width: 50%; */
color: #000;
margin: 8px 0 0 20px;
word-wrap: break-word;
word-break: break-word;
overflow: hidden;
}
If you'd like to see the full and functioning code, feel free to check out this JS Fiddle - http://jsfiddle.net/varunksaini/Zjxq5/10/