使内容适合div的宽度 [英] Make content fit to the width of the div
本文介绍了使内容适合div的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让文字适合div的宽度。这是我的代码
< div class =column>
< a href =#class =user_thumbnail>
< img src =<?= base_url()?> /images/1.jpgwidth =100pxheight =100px>
< / a>
< span class =name> texttexttexttexttexttexttexttexttexttext< / span>
< / div>
当我试图显示文本时,文本溢出div像直线。
我如何做css适合< div class =column>
(width = 33%)的宽度的文本。
解决方案
word-wrap:break-word
/ p>
- 在下一行中加入长字。
- 调整不同的字词,
code> .column {
width:33%;
word-wrap:break-word;
}
How can I make a text fit to the width of div. Here is my code
<div class="column"> <a href="#" class="user_thumbnail"> <img src="<?=base_url()?>/images/1.jpg" width="100px" height="100px"> </a> <span class="name">texttexttexttexttexttexttexttexttexttext</span> </div>
When I have tried to display the text, the text overflows out of the div like a straight line. How can i do css to fit the text to the width of
<div class="column">
(width = 33%).解决方案word-wrap:break-word
- Wrap long words onto the next line.
- Adjust different words so that they do not break in the middle.
So try the below CSS
.column { width: 33%; word-wrap: break-word; }
这篇关于使内容适合div的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文