如何将图像缩放为与段落相同的大小?像这样?
这就是我的网站看起来像的样子
到目前为止,这是我的代码Html和CSS
CSS和HTML
.paragraphers
{
padding-left: 250px;
width: 100px;
height: 20px;
}
.pix
{
float: right;'
width: 100px;
height:20px;
padding-right: 250px;
}
<div class = paragraphers>
<p class = paragraphers>
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
</div>
<div class = pix>
<img src = "images/stocktests/stock.jpg" id = pix>
</div>
</body>
</html>
我认为您应该尝试网格系统。这里的CSS:
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
grid-gap: 10px;
padding: 30px;
}
.grid-container > div {
text-align: center;
padding: 30px 0;
font-size: 30px;
}
.item1 {
grid-column-start: 1;
grid-column-end: 2;
}
p {
padding: auto 100px;
}
和HTML:
<div class="grid-container">
<div class="item1">
<p style="font-size: 20px">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sunt officia autem quas architecto deleniti nisi reiciendis distinctio, nihil necessitatibus! Corporis.</p>
</div>
<div class="item2">
<img src = "coffee.jpg" style="width: 900px; height: 300px">
</div>
</div>
试试这个,我希望你能找到这个有用的