问题
i have a mail template newsletter here: http://www.newsletter.vendopor.com/m29-04-13/index2.html
But at the end, have a paragraph that contains that text: Por favor, envía este correo a las personas que creas le puede ayudar nuestro...
And this text, go out the paragraph (i have a width 380 attribute in css and keeps going out).
It's at the end of the page
I've searched in google, but can't find the solution
Works fine on Chrome, but in Mozilla (last version) the text is going out.
Thanks a lot for your help
回答1:
You can use text-overflow: ellipsis;
div {
width:200px;
overflow:hidden;
border:1px solid #f00;
text-overflow:ellipsis;
white-space:nowrap;
}
<div>This is very very long text This is very very long text This is very very long text </div>
Good Luck...
回答2:
<?php echo substr('your text',0,500); ?>
prints the first 500 characters of your text
Or when you don't want to use php and just want the text to dissapear when the end of the block is reached add overflow:hidden;
in the css of the div block
回答3:
I found it, this added to the paragraph: white-space: normal; you can learn some about white-space here: sidar.org/recur/desdi/traduc/es/css/… it works good now in mozilla thx a lot to all!
来源:https://stackoverflow.com/questions/16193279/how-can-i-limit-a-text-inside-a-p