CSS栏中包含图片的文字

删除数据库

在此处输入图片说明

这是给我的电子书应用程序。列的高度会有所不同。因此,图像位置很难预测。我使用-webkit-column-break-before:总是; 以防止图像在列之间划分。但是此方法留有空白空间。

是否可以用第二行中的文字填充第二行中的空白空间?你怎么看?

https://jsfiddle.net/rg9kvnys/

#mydiv{
  width:1000px;
  height:200px;
  -webkit-column-width:200px;
  border-style:solid;
 }

#image{
  box-sizing:border-box;
  border-style:solid;
  border-color:red;
  background-color:lightblue;
  height:100%;
  -webkit-column-break-before: always;
}
G-西里尔

我可能评论得太快了。您需要float #image

#mydiv {
  width: 1000px;
  height: 200px;
  -moz-column-width: 200px;
  -webkit-column-width: 200px;
  column-width: 200px;
  border-style: solid;
  /* eventually */
  -moz-column-fill: balance;
  -webkit-column-fill: balance;
  column-fill: balance;
}

#image {
  box-sizing: border-box;
  border-style: solid;
  border-color: red;
  background-color: lightblue;
  float: left;
  -moz-column-break-before: always;
  -webkit-column-break-before: always;
  column-break-before: always;
}
<div ID="mydiv">
  But I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of
  human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely
  <div ID="image"><img src="http://lorempixel.com/190/190/people" /></div> painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some
  great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences,
  or one who avoids a pain that produces no resultant pleasure?But I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings
  of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are
  extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which
  of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant
  pleasure?
</div>

https://jsfiddle.net/rg9kvnys/3/

或没有height设置,column-fill也可以派上用场https://jsfiddle.net/rg9kvnys/2/

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章