Reputation: 784
I have a html list with following items:
<ul>
...
<li>Counter party: <span><em>GB15MIDL400515123111145671111111118</em></span></li>
...
</ul>
...
The problem is when I visualize this with a smaller screen, the EM value goes outside the borders of my list:
What can I do at my css to get the em value inside the borders.
Upvotes: 4
Views: 1287
Reputation: 67748
if you want the division with a hyphen at one (or several) particular character/s, you can insert ­
(="soft hyphen"), also several times:
<span><em>GB15MIDL­400515123­1111456711­11111118</em></span>
This will break the word at the last "­
" position that still fits into the line. If the line is long enough, you won't see those entities.
Upvotes: 0
Reputation: 61
you need to set a width to your paragraph and change the width in diffrent screens with Media Queries
Upvotes: 0
Reputation: 122027
You can use word-wrap: break-word
li {
border: 1px solid black;
width: 100px;
word-wrap: break-word;
}
<ul>
<li>Counter party: <span><em>GB15MIDL400515123111145671111111118</em></span></li>
</ul>
Or word-break: break-all
li {
border: 1px solid black;
width: 100px;
word-break: break-all;
}
<ul>
<li>Counter party: <span><em>GB15MIDL400515123111145671111111118</em></span></li>
</ul>
Upvotes: 6