如何在不使用空格的情况下使HTML中的文本列看起来像这样?
仅CSS可行吗?我觉得这将成为jQuery领域。
.column{
Width:300px;
height:auto;
background-color:#999;
}
<div class="column">
<p>
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna</p> <p>aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
</div>
答案 0 :(得分:2)
可以使用CSS shape-outside
属性来实现。这样会将内容包裹在圆形,椭圆形或多边形等形状周围。
对于Triangle Bottom Left
这种形状,可以使用polygon
ref:https://developer.mozilla.org/en-US/docs/Web/CSS/shape-outside
.column {
width:50%;
background-color:#999;
}
.shape {
-webkit-shape-outside: polygon(0 0, 100% 100%, 0 100%);
shape-outside: polygon(0 0, 100% 100%, 0 100%);
float: left;
width: 100%;
height: 30em;
}
<div class="column">
<div class="shape"></div>
<p>
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna</p> <p>aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
</div>
注意:IE浏览器不支持