CSS: 无法让文字浮动到我的图片右侧
CSS: Can't get text to float to the right of my image
应该很简单,而且我在这里阅读了足够多的帖子,这应该很简单。所以当然不是....
我只是想将文本浮动到图像的右侧。一直在尝试对我的位置、展示和浮动进行不同的调整。都无济于事。
如果您查看 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.....
将 clear: none;
添加到您的 h3 标签
添加display:inline块和clear:none或clear:right到h3
添加 display:block 到 img
应该很简单,而且我在这里阅读了足够多的帖子,这应该很简单。所以当然不是....
我只是想将文本浮动到图像的右侧。一直在尝试对我的位置、展示和浮动进行不同的调整。都无济于事。
如果您查看 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.....
将 clear: none;
添加到您的 h3 标签
添加display:inline块和clear:none或clear:right到h3 添加 display:block 到 img