html - CSS:如何将图像放置在两列中,并带有换行文本?(包括图片供参考)
问题描述
我有一篇文章正在变成 html。这篇文章有两列,有一张图片从一列溢出到另一列,如本文的屏幕截图所示:
我在弄清楚如何定位此图像时遇到了一些困难。如果我使用位置:绝对,它只是位于文本的顶部。关于我如何解决这个问题的任何建议?
解决方案
你可以试试这个。
.image1 img {
width: 678px;
height: 350px;
margin-left: -140px;
padding: 10px;
}
.wrapit {
width: 75%;
text-align: justify;
}
@media(max-width:991px) {
.wrapit {
width: 100%;
text-align: left;
}
.image1 img {
width: 100%;
height: 100%;
margin-left: 0;
padding: 10px;
}
}
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<div class="container">
<div class="col-md-12 text-center">
<h1>Two colum with image</h1>
</div>
<div class="row">
<div class="col-md-6">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<br>
<div class="wrapit">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</div>
when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="col-md-6">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<div class="image1"><img src="http://icrs.org.il/wp-content/uploads/2018/06/pojo-placeholder-2-2.png"></div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</body>
</html>
推荐阅读
- python - 如何将逗号分隔的对象导出到 .csv 文件中
- mips - MIPS中的lhu和lbu有什么区别?
- html - [Python]Robot Framework中的Selenium关键字点击标签内的span role="button"
- python - 设置聊天机器人
- python-3.x - Odoo 14 Longpolling Bus.bus 错误 - Apache2
- python - 如何使用 discord.py 使用命令创建列表?
- jquery - 如何在 ASP.NET MVC 中使用 Ajax 调用刷新局部视图?
- postgresql - 如何在 postgresql 中更新 Jsonb 列的单个元素
- python - Gensim LDA:错误无法在空集合上计算 LDA(无术语)
- firebase - 防止 Firestore 集合中的时间戳重叠