文本与css列中的图像

时间:2017-02-19 00:06:38

标签: css

enter image description here

这适用于我的电子书应用。列的高度会有所不同。因此图像位置很难预测。我使用 -webkit-column-break-before:always; 来保护图像不被列分割。但是这种方法留下了空白。

是否可以使用上一个文本填充第二列中的空白区域?你觉得怎么样?

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;
}

1 个答案:

答案 0 :(得分:1)

我的评论太快了。您需要CustomerDB.insertData(allData); CustomerDB.outputCustomerById(71); 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;
}

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

或没有<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>设置和height也可以派上用场https://jsfiddle.net/rg9kvnys/2/