0

enter image description here

This is for my ebook app. Height of the columns will vary. So image location is difficult to predict. I use -webkit-column-break-before: always; to preserve images from being divided between columns. But this method leaves empty space.

Is it possible to fill empty space in the second column with text from the last? What do you think?

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;
}
3
  • Are you using bootstrap? Commented Feb 19, 2017 at 0:07
  • 1
    nop, text won't flow around image to fill a gap; :( Commented Feb 19, 2017 at 0:20
  • . . . after all it would around floatting elements : jsfiddle.net/rg9kvnys/3 Commented Feb 19, 2017 at 0:30

1 Answer 1

1

i might have commented too fast. you need to 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/

or without an height set and column-fill also that can come handy https://jsfiddle.net/rg9kvnys/2/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.