Hide text going beyond DIV element
- Is there anyway to make text going beyond the boundary invisible?
- Is it possible to break it into multiple lines, or -even better- break into multiple lines with a hypen at the end of each broken line?
Regards,
RafidYou can do this with CSS.
Is there anyway to make text going beyond the boundary invisible?
Yep: overflow
#yourDivId {
overflow: hidden;
}
Is it possible to break it into multiple lines
Yep: word-wrap
#yourDivId {
word-wrap: break-word;
}
You could use CSS:
div {
overflow: hidden;
}
Or:
overflow: auto;
For more: https://developer.mozilla.org/en/docs/Web/CSS/overflow
The answer to your first question is to use the following style:
overflow: hidden;
Alternatively, if you want to be able to scroll in the div to see the content you can do
overflow: auto;
or
overflow: scroll;
To do what you ask in your second question you'd need some javascript.
精彩评论