如何以各種屏幕尺寸完美地放置圖像?靠近div的位置圖像完美
.background-login {
background: url(../img/login.png) no-repeat;
background-size: 100%;
z-index: -2;
position: absolute;
top: 8%;
min-height: 400px;
right: 2%;
height: 100%;
}
.background-login-create {
background: url(../img/login.png) no-repeat;
background-size: 100%;
z-index: -2;
position: absolute;
top: 17%;
min-height: 400px;
right: 2%;
height: 100%;
}
.background-login-create-profile {
background: url(../img/login.png) no-repeat;
background-size: 100%;
z-index: -2;
position: absolute;
top: 13%;
min-height: 400px;
right: 2%;
height: 100%;
}
.sellfie-start-text {
font-size: 15px;
padding: 145px;
text-align: center;
font-weight: 200;
position: relative;
top: 8%;
vertical-align: middle;
color: #FFF;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container div-login">
<div class="row">
<div class="col-sm-5 col-md-offset-1">
<div class="center">
<h2 class="login-title"></h2>
<h4></h4>
<p class=""></p>
</div>
<div class="account-wall">
<p class="profile-name">Hello!<span style="color:red">:)</span></p>
<p class="profile-desc">We require only your mobile number for both login and signup</p>
<br>
<div class="form-signin">
<div class="md-form">
<input type="text" placeholder="Enter Mobile Number" value="" name="mobile_number" id="mobile_number" class="mobile_number form-control">
</div>
<button class="btn btn-main btn-continue" id="continue">
CONTINUE</button>
<div class="form-signin-bottom">By clicking on Continue, you agree to our <a href="">Privacy Policy</a>
& <a href="">Terms</a>
</div>
</div>
</div>
</div>
<div class="col-sm-6 background-login">
<div class="sellfie-logo">
<img src="img/sellfie_white.png"/>
</div>
<div class="sellfie-start-text">
Sellfie is the easiest way to sell online and collect payments for your products & services on social networks
and online channels.
</div>
</div>
</div>
</div>
如果左容器越大,我想我的右影像是相同的高度左容器是什麼?
.background-login {
background: url(../img/login.png) no-repeat;
background-size: cover;
z-index: -2;
position: absolute;
margin-top: 50px;
right: 2%;
min-height:400px;
height: 100%;
}
你想是這樣的鏈接:-https://css-tricks.com/perfect-full-page-background-image/ –
我做了這個簡單的[小提琴](https://jsfiddle.net/4jjrjy5j/),它使用相對和絕對定位。你的容器應該是相對的,你的左和右的內容應該是絕對的。嘗試並改變我的[fiddle](https://jsfiddle.net/4jjrjy5j/)中的'wrapper'寬度和高度,您可以看到內容將會改變。 [有用的示例](https://css-tricks.com/absolute-positioning-inside-relative-positioning/) – Roy123
我很困惑,爲什麼有什麼需要是絕對的? – Tom