CSS中的图像调整
为图像提供了一些帮助。CSS中的图像调整
这是HTML
<div class="main">
<div class="loginform">
<h1 align="left">'Welcome to .'</h1>
<p align="left">'Supporting our customers by providing documentation for all products across the Suite.'</p>
</div>
<div class ="background"></div>
</div>
这是最新的CSS
.main {
widht: 400px;
height:100px;
}
.background
{
background-
image:url("icon.png?la=en&h=270&w=320");
background-repeat: no-repeat;
background-position:right;
position:relative;
opacity: 0.6;
filter: alpha(opacity=60);
height:300px;
width:300px;
z-index:1;
top:-105px;
left:78%;
clear:both;
}
我的形象看起来像这样:![在这里输入的形象描述] [1] [1 ]
我很想拥有它。绿色图像不应在密码框中可见。 [![输入图片描述] [2]] [2]
再次感谢您的帮助。
简而言之,图片必须是loginform的背景图片。 Jsfiddle example
.loginform {
width: 500px;
height: 250px;
float: left;
background-image: url('http://www.itsmfonline.org/wp-content/uploads/2014/02/accenture_high_performance.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: right center;
}
感谢您的答复。我没有得到确切的结果。让我玩弄值和检查。 –
嗨Aivaras,请你检查我上面附上的第三张图片。 –
Like @Anubhav表示,如果我们能看到您的完整CSS,这将非常有帮助 –
您还可以通过位置实现这一目标的图像相对向main
股利。 在这种情况下,您应该使用z-index。请参阅示例:JSFIDDLE
我创建了自己的HTML代码。您应该将这些CSS设置应用于您自己的代码。
<div class="main">
<h1>
Welcome To
</h1>
<p>
Supporting our customers
</p>
<form>
<div class="left">
Username<br/><input type="text" name="username">
</div>
<div class="right">
Password <br/><input type="text" name="password">
</div>
<div class="clear"></div>
</form>
<div class="background"></div>
</div>
的CSS:
.main {
width: 400px;
height: 1000px;
background-color:#fff;
}
form{
cleaR:both;
position:relative; /* To set the Form above the bg image */
z-index:3; /* To set the Form above the bg image */
background-color:yellow;
}
.left, .right{
width:48%;
margin-left:1%;
margin-right:1%;
float:left;
position:relative;
z-index:0;
}
.left input, .right input{
width:100%;
}
.background{
background-image:url("http://www.iconsdb.com/icons/preview/white/arrow-25-xxl.png");
background-repeat: no-repeat;
background-position:right;
height:200px;
width:200px;
position:relative; /* To set the bg behinde the form */
z-index:1; /* To set the bg behinde the form */
top:-120px; /* Set the position of the BG image */
left:79%; /* Set the position of the BG image */
background-color:green;
}
.clear{clear:both;}
@PankajMorajkar我真的没有得到你想要的。你只是想让密码框背后的图像正确吗? – Rotan075
嗨Rotan ...感谢您帮助我解决这个问题....是的,我想要它在图2所示的框后面。我尝试了很多选项,但仍然没有得到它... –
嗨Rotan ...我用最新的CSS修改了这个问题。你能检查吗?再次感谢你的帮助。 –
入住此示例代码https://jsfiddle.net/gdqkjade/
测试CSS
.main {
widht: 400px;
height: 100px;
}
.input_fields{margin-top: 100px;}
.background {
background-image: url("https://www.accenture.com/t20160121T034706__w__/us-en/_acnmedia/Accenture/Conversion-Assets/DotCom/Images/Global/Technology_19/Accenture-T1-Green-Forward-Mark-icon.png?la=en&h=270&w=320");
background-repeat: no-repeat;
background-position: right;
opacity: 0.6;
filter: alpha(opacity=60);
height: 300px;
width: 300px;
z-index: -1;
float: right;
margin-top: -15px;
right: 0;
position: absolute;
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
input{width: 90%;}
测试HTML
<div class="main">
<div class="loginform">
<h1 align="left">'Welcome to ALIP Documentation Center.'</h1>
<p align="left">'Supporting our customers by providing documentation for all products across the Suite.'</p>
<div class="background"></div>
<div class="input_fields">
Username
<br/>
<input type="text" name="username">
</div>
<div>
Password
<br/>
<input type="text" name="password">
</div>
</div>
</div>
嗨Aldrien ...当我尝试你的代码时,图像完全在盒子后面。看起来你的代码是正确的。我正在尝试这个网站有容器与用户名和密码框。我想我必须瞄准容器。 –
我该如何定位...例如,如果容器是“mt-content-container”,我可以用什么CSS来实现我的目标? –
对不起还不确定这是否是正确的问题,但只是寻找指导。 –
请给你的CSS –