html - CSS:如何跨两列定位图像,并带有换行文字? (内含 img 供引用)

标签 html css sass col

我有一篇文章,我正在将其转换为 html。文章有两栏,并且有一张图片从一栏溢出到另一栏,如本文的屏幕截图所示:

enter image description here

我在弄清楚如何放置这张图片时遇到了一些困难。如果我使用 position: absolute,它就位于文本之上。关于我如何解决这个问题有什么建议吗?

最佳答案

enter image description here

你可以试试这个。

.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>

关于html - CSS:如何跨两列定位图像,并带有换行文字? (内含 img 供引用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53757146/

相关文章:

javascript - 单击菜单时应用过渡效果以减慢子菜单的打开速度

javascript - 哪些视频播放器不需要文件格式转换?

javascript - 进行图像翻转的最佳方法?

reactjs - webpack:SASS 加载器失败 "Module build failed (from ./node_modules/sass-loader/lib/loader.js)"

php - 可以在 PHP "if"语句中嵌入 HTML 吗?

javascript - 从 div 获取值到文本框

html - 对 css 和 html 没有响应

css - 用 RGBA 颜色覆盖 CSS 渐变?

javascript - ExtJS 主题修改 Ext.panel.Panel

html - 如何封装CSS属性防止重蹈覆辙