2017-02-19 2 views
0

enter image description hereCSS 열에 이미지가 포함 된 텍스트

내 전자 책 앱용입니다. 기둥의 높이는 다양합니다. 따라서 이미지 위치를 예측하기가 어렵습니다. 나는 -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; 
} 
+0

는 부트 스트랩을 사용하고 편리하게 올 수 있습니까? –

+1

nop, 간격을 메우기 위해 텍스트가 이미지 주위로 흐르지 않습니다. :( –

+0

... 결국 요소를 떠 다니는 것입니다 : https://jsfiddle.net/rg9kvnys/3/ –

답변

0

내가 너무 빨리 댓글을 달았 수 있습니다. 당신은 float#image해야합니다

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

또는 height 설정없이 column-fill

#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/2/

+0

예, float이 트릭을 수행 할 것 같습니다. 감사합니다! –

관련 문제