小编Tin*_*Syu的帖子

在浮动图像周围打破长字

我正在尝试在移动设备上创建页面显示.它的布局是这样的:

/---------\ some text around 
|         | the image. some
|  image  | text around the
|         | image. some text
\---------/ around the image.
some word around the image.
some word around the image.
Run Code Online (Sandbox Code Playgroud)

我使用浮动样式来实现:

<div style="word-wrap: break-word; word-break: break-all;">
  <img src="someimg.jpg" style="float: left;"/>
  some text around the image. some text around the image. ...
</div>
Run Code Online (Sandbox Code Playgroud)

但是,如果单词长度超过右侧区域最大长度但短于整个div,则不会中断,而只是将其移动到图像下方.

/---------\ some text around 
|         | the image.
|  image  | 
|         | 
\---------/ 
a-word-longer-than-right will
not be break and just display …
Run Code Online (Sandbox Code Playgroud)

css word-wrap css-float

6
推荐指数
1
解决办法
1861
查看次数

标签 统计

css ×1

css-float ×1

word-wrap ×1