右块元素不在最右边
来源:4-3 编程练习
慕少5306396
2019-03-18 09:43:29
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
padding:0;
margin:0;
}
.bg {
width:100%;
height:4000px;
background:url(http://climg.mukewang.com/59c9f7ce0001839219034033.png) no-repeat ;
}
.bg .guangg1{
width:340px;
height:340px;
background:url(http://climg.mukewang.com/5a3383c70001f1b702240364.png) no-repeat;
position:fixed;
top:50%;
margin-top: -170px;
right: 0;
}
.bg .guangg2{
width:340px;
height:340px;
background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png) no-repeat;
position:fixed;
top:50%;
margin-top: -170px;
left: 0;
}
</style>
</head>
<body>
<div class="bg">
<div class="guangg1"></div>
<div class="guangg2"></div>
</div>
</body>
</html>
2回答
全粘攻城狮
2019-03-18
来个float:right;
Steve007
2019-03-18
同学,你好。因为右边盒子的大小为340 X 340,图片没有充满整个盒子,设置盒子的大小为图片的大小220px,就可以实现效果了,如图:
祝学习愉快!
相似问题
回答 1
回答 1