Link text sticks out of div

to make it simple, I have the following code:

<div>
     <a>view all your links</a>
</div>

the width of the div is very small, so the text "all your links" sticks out of the div. How can I make a new line after "all yours" so "links" do not stick out?

+3
source share
4 answers

Use the max-widthproperty for your alinks.

Edit: you may need display: blockfor your tag a.

+1
source

. , div , ? , -. , ? , overflow: hidden div.

+2

If you want to visually break the links so that they do not expand from the div, you can add word-wrap: break-wordto the astylesheet. Thus:

a {
    word-wrap: break-word;
}
+2
source

Use this code:

a {
    word-wrap: break-word;
    white-space: normal;
}
0
source

Source: https://habr.com/ru/post/1730615/


All Articles