打破巨大的网址,这样它们就不会溢出
有没有办法强制使用巨大的网址,例如http://www.google.de/search?q=65daysofstatic&hl=de&safe=off&prmd=ivnsl&source=lnms&tbm=isch&e i=P9NkToCRMorHsgaunaClCg&sa=X&oi=mode_link&ct=mode&cd=2&ved=0CBkQ_AUoAQ&biw=1697&bih=882
在网站中呈现时中断?我宁愿缩短它,但在我工作的地方,他们要求我显示整个网址,但我只有 320px 的空间来显示它,它就溢出了。
Overflow:hidden 也不是一个选项,并且向包含 url 的 td 添加样式将被简单地忽略。
Is there a way to force huge urls such as http://www.google.de/search?q=65daysofstatic&hl=de&safe=off&prmd=ivnsl&source=lnms&tbm=isch&ei=P9NkToCRMorHsgaunaClCg&sa=X&oi=mode_link&ct=mode&cd=2&ved=0CBkQ_AUoAQ&biw=1697&bih=882
break when rendered in the website? I'd rather shorten it but where I'm working they've asked me to show the entire url but I only have a space of 320px to show it and it overflows.
Overflow:hidden, isn't an option either and adding a style to the td where the url is contained is simply ignored.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 Chrome 中,自动换行不起作用。您应该使用:
如果您只想将其应用于标签,那么您应该使用:
请注意
break-all
甚至会分割单词,因此一个单词可以在一行上开始并在另一行上结束,这就是为什么最好只将其应用于a
标记。如果您知道您的链接始终包含单词(例如不是类似 mylink/abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890 ),然后您可以在正文标记级别应用以下内容(这样一个单词就不会分成两行):In Chrome,
word-wrap
does not work. You should use:If you want to apply it only on a tags, then you should use:
Note that
break-all
will even split words, so a word can start on one line and end on another, that's why it's a good idea to apply it only ona
tags. If you know that your links always contain words (e.g. are not something like mylink/abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890 ), then you can apply the following at the body tag level (this way a word is not split onto 2 lines):CSS3 有一个新功能:
您可以在此处查看一个实例(您必须拥有与其兼容的浏览器)新功能)。
这也与 StackOverflow 采用的技术相同,如果您检查长 URL,您会发现。
或者,您也可以尝试Hyphenator。
CSS3 has a new feature:
You can see a live example here (you must have a browser compatible with that new feature).
It's also the same tecnique adopted by StackOverflow, if you examine your long URL you will notice.
Alternatively you can try Hyphenator.
以上适用于 Internet Explorer 8+、Firefox 6+、iOS 4.2、Safari 5.1+ 和 Chrome 13+。
The above works in Internet Explorer 8+, Firefox 6+, iOS 4.2, Safari 5.1+ and Chrome 13+.
溢出包装来救援:
它具有几乎完整的浏览器支持,当您的长单词(EG URL)无法容纳可用空间时,它将提供帮助
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
overflow-wrap to the rescue:
it has pretty much full browser support and will help when your long word (E.G URLs) cannot fit in the available space
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap
我使用此规则仅影响锚点。
I use this rule to affect only anchors.
尝试下面的 CSS 属性 将长文本 URL 显示为短文本...
try below CSS properties for show long text URL to short...