html - 在动态文章文本中 float 一个 Div

标签 html css dynamic

我有一个基于参数查询的动态页面:

site.com/news/?article=3334 (One Article)
site.com/news/?article=3335 (Another Article)

根据文章 ID,页面会动态填充适当的文章文本。

对于每篇文章,应该有一个带有次要图像的 div 向下推 7 到 10 行并向右浮动,文字环绕在它周围。

Dynamic Div Float

p {
  margin: 0;
  padding: 0;
}

#article_frame {
  background-color: yellow;
  width: 100%;
  position: relative;
}

.article_title {
  font-size: 3.5em;
  padding-bottom: 10px;
  border-bottom: solid 1px gray;
  margin-bottom: 10px;
}

.article_content {
  font-size: 1.45em;
  line-height: 1.65em;
}

#article_gallery {
  background-color: red;
  width: 250px;
  float: right;
}

.article_badge {
  width: 250px;
  height: 250px;
}

.article_badge_descript {
  font-size: .8em;
}
<div id="article_frame">
  <p class="article_title">Title Goes Here</p>
  <div class="article_content">
    <div id="article_gallery">
      <img class="article_badge" src="">
      <p class="article_badge_descript">Gallery Description Here.</p>
    </div>
    Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here.
    Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. <br><br> Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article
    text goes here. Testing article text goes here. <br><br> Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. <br><br> Testing article text
    goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here. Testing article
    text goes here. Testing article text goes here. Testing article text goes here. Testing article text goes here.
  </div>
</div>

图片库 div 位于顶部,但我想将其向下推 7 到 10 行,同时仍允许文本环绕 div 本身。

最佳答案

为什么不在 article_gallery 上方创建一个 div 并包含任何您希望在那里全长显示的文本?

<div class="article_content">
  <div>
    Top text goes here.
  </div>
  <div id="article_gallery">
  ...
</div>

参见示例 here

关于html - 在动态文章文本中 float 一个 Div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34583196/

相关文章:

javascript - 我怎样才能使一个div保持在另外两个与jqueryui幻灯片同步的div下方?

html - 图像上的导航箭头

javascript - eval_in_page javascript 执行在 firefox 中有效,但在 phantomjs 中无效

css - 我的网站标题图片未在移动设备上调整大小

html - Bootstrap 中心 div 旁边有右侧 div

javascript - 在使用javascript加载页面之前从数组中缓存动态图像

javascript - 列表中的 Div 应该在所有列表的顶部

html - YouTube嵌入代码Internet Explorer 11

javascript - 隐藏带有文本内容的tr(表格行)

javascript - 验证具有未知 id 和公共(public)类的动态 HTML Select 的空值