gpt4 book ai didi

html - 以滑出 div 的方式 float 图像

转载 作者:行者123 更新时间:2023-11-28 06:52:43 25 4
gpt4 key购买 nike

我想以滑出 div 的方式 float 图像。我什至为图像添加了负边距,但实际情况是 iPhone 图像一直被截断。

我也尝试包括图像的高度和宽度,但没有任何效果。

请帮忙。

.blue-wrapper {
background: #41A7D3;
width: 100%;
overflow: hidden;
}
.blue {
width: 1000px;
margin: 0 auto;
padding: 0;
}
.blue-left {
float: left;
width: 39%;
}
.blue-left img {
display: block;
margin-top: -100px;
width: 380px;
height: 739px;
}
.blue-right {
float: right;
width: 61%;
color: #FFFFFF;
}
<div class="blue-wrapper">
<div class="blue">

<div class="blue-left">
<img src="https://feverweb.s3.amazonaws.com/landing/images/iphone-white.png" alt="3rd iPhone">
</div>
<!-- Blue Left -->

<div class="blue-right">

<div class="blue-text">
<h2>What ComeAgain Can Do for Your Business</h2>
<p>Lorem ipsum dolor sit amet, id sonet conclusionemque mel, denique nominavi instructior at mea. Ea utamur persecuti vis. Omnes perfecto menandri est ut, quot nonumy vix at. Et vix vocent corrumpit definiebas. Ut legere vocibus fierent nec, ei dicit
everti patrioque sed. Mel verear impetus et, fugit vocent ut nam.
</p>

<h3>How ComeAgain Works</h3>
<ul>
<li>You always get a Reward with your 1st Purchase at any ComeAgain Location!</li>
<li>Then ComeAgain… when you fill up a Rewards Card, you get a Free Reward!</li>
</ul>
</div>
<!-- Blue Text -->

<div class="blue-button">
<a href="#">Get Registered</a>
</div>
<!-- Blue Button -->

</div>
<!-- Blue Right -->

</div>
<!-- Blue -->
</div>
<!-- Blue Wrapper -->

最佳答案

.blue-wrapper {
background: #41A7D3;
width: 100%;
}

.blue {
width: 1000px;
margin: 0 auto;
padding: 0;
}

.blue-left {
float: left;
width: 39%;
position: relative;

}

.blue-left img {
display: block;
top: 100px;
width: 380px;
height: 739px;
position: absolute;
}


.blue-right {
float: right;
width: 61%;
color: #FFFFFF;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
/* start commented backslash hack \*/
* html .clearfix { height: 1%; }
.clearfix { display: block; }
/* close commented backslash hack */
<div class="blue-wrapper clearfix">
<div class="blue">

<div class="blue-left">
<img src="https://feverweb.s3.amazonaws.com/landing/images/iphone-white.png" alt="3rd iPhone">
</div><!-- Blue Left -->

<div class="blue-right">

<div class="blue-text">
<h2>What ComeAgain Can Do for Your Business</h2>
<p>Lorem ipsum dolor sit amet, id sonet conclusionemque mel, denique nominavi instructior at mea.
Ea utamur persecuti vis.
Omnes perfecto menandri est ut, quot nonumy vix at. Et vix vocent corrumpit definiebas.
Ut legere vocibus fierent nec, ei dicit everti patrioque sed. Mel verear impetus et, fugit vocent ut nam.
</p>

<h3>How ComeAgain Works</h3>
<ul>
<li>You always get a Reward with your 1st Purchase at any ComeAgain Location!</li>
<li>Then ComeAgain… when you fill up a Rewards Card, you get a Free Reward!</li>
</ul>
</div><!-- Blue Text -->

<div class="blue-button">
<a href="#">Get Registered</a>
</div><!-- Blue Button -->

</div><!-- Blue Right -->

</div><!-- Blue -->
</div><!-- Blue Wrapper -->

对于背景,您应该在包装器上添加一个 .clearfix。

关于html - 以滑出 div 的方式 float 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33690055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com