右块元素不在最右边
来源:4-3 编程练习
慕少5306396
2019-03-16 09:27: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) left no-repeat; position:fixed; top:50%; margin-top: -170px; } .bg .guangg2{ width:340px; height:340px; background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png) no-repeat; background-position: right; position:fixed; top:50%; margin-top: -170px; } </style> </head> <body> <div class="bg"> <div class="guangg1"></div> <div class="guangg2"></div> </div> </body>
1回答
水晶面条
2019-03-16
.bg .guangg2{
position:fixed;
right:0;
}
方向设置一下就可以了
左侧left:0; 右侧right:0;
相似问题
回答 2
回答 1