不能做最大宽度 [英] not able to do max width

查看:99
本文介绍了不能做最大宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个拥有这样内容的网页...

I have a page which has a content like this...

<div id="content">
testingtestingtestingtestingtestingtestingtestingtestingtesting
testingtestingtestingtestingtestingtestingtestingtesting
testingtestingtestingtestingtesting
</div>

如何对其应用最大宽度。我在css中使用这个代码

How do i apply a max-width on it . I m using this code in the css

#content {
    max-width:50px; /* for standards-compliant browsers */
   /*width:expression(document.body.clientwidth > 650? "650px": "auto" );*/ 
   /* max-width expression for IE only */
}

但是没有得到结果在firefox ...
http://pradyut.dyndns.org/WebApplicationSecurity/width.jsp

but i m not getting the results in firefox... http://pradyut.dyndns.org/WebApplicationSecurity/width.jsp

有没有JavaScript解决方案?

任何帮助

感谢您
Pradyut

Are there any JavaScript solutions?
Any help
thanks
Pradyut

推荐答案

因此,在您的CSS中,您可以设置 c-> word-wrap 属性 break-word ,以便您的文本字符串(w /无空格)适合最大宽度:

So, in your CSS, you can set the word-wrap property to break-word so that your string of text (w/ no whitespace) will be made to fit into the max-width:

例如

<style type="text/css">

#content {
    max-width: 50px;
    word-wrap: break-word;
}

</style>

这篇关于不能做最大宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆