CSS:无法将文本浮动到我的图像右侧

问题描述 投票:-1回答:2

应该是这么简单,我一直在阅读足够的帖子,这应该是一个快照。所以当然不是......

我只是试图将文本浮动到我的图像右侧。一直在尝试与我的位置,显示和浮动不同的大头钉。一切都无济于事。

如果您查看https://staging.hellodadventures.com并向下滚动到“DadVentures Deal”出现的位置,大约在页面中间,您将看到它。

这是我的代码首先是HTML:

.dadventures-deal img {
  position: relative;
  float: left;
  z-index: 251;
}

.dadventures-deal h3 {
  position: relative;
  float: left;
  background: #FFF;
  color: #F00;
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: 16px;
  top: 12px;
  padding: 8px 14px;
  z-index: 250;
}
<div class="row-deals">
  <a href="https://staging.hellodadventures.com/event/santa-monica-pier-aquarium/" title="Santa Monica Pier Aquarium">
    <div class="feature">
      <figure class="fixedratio" style="background: url('https://staging.hellodadventures.com/wp-content/uploads/2019/03/healthebay-aquarium-e1551648109222.jpg');"></figure>
      <div class="feature-bottom">
        <h2>Santa Monica Pier Aquarium </h2>
        <div class="dadventures-deal"><img src="https://staging.hellodadventures.com/wp-content/themes/dadvation/img/symbol-dadventures.png" alt="DadVentures Deals">
          <h3>DadVentures Deal</h3>
        </div>
      </div>
    </div>
  </a>
</div>

再次,应该是直截了当的,但那令人讨厌的CSS .....

html css image css-float
2个回答
0
投票

添加显示:inline-block和clear:none或clear:右到h3添加display:block to img


0
投票

clear: none;添加到您的h3标签

© www.soinside.com 2019 - 2024. All rights reserved.