在网络上搜索了几周,但找不到满足我所有需求(仅部分)的答案,非常欢迎帮助。
我想要并已完成的事情:
<figure class="left">
)现在我想添加这些要求:
<figure class="left" style="width:200px">
但前提是没有其他方法。我离开的地方:
figure {
display: inline
}
figcaption {
display: block
}
figure.left {
float: left
}
figure.right {
float: right
}
Run Code Online (Sandbox Code Playgroud)
<p>This is a part of the text of the article and at this point a image is inserted at the left side
<figure class="left" style="width:250px">
<img src="image.png" alt="img txt">
<figcaption>image caption and a lot of text</figcaption>
</figure>
and the article text goes on and on so that it will wrap around the image</p>
Run Code Online (Sandbox Code Playgroud)
(我省略了填充/边距等以使其看起来更好。)
小智 2
尝试以下 css,看看当您调整浏览器大小时,文本会在图像上换行:
.left {
float: left;
border: 5px solid #BDBDBD;
background: #E0E0E0;
padding: 5px;
margin: 0px;
}
figcaption {
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)