4-3编程练习,麻烦老师看看。主要觉得有点不对经。

来源:4-3 编程练习

D淼

2018-04-15 14:47:52

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>lianxi</title>

<style type="text/css">


*{margin: 0;padding: 0;}

.q{width: 1230px;

  height:2500px;

  background: url("http://climg.mukewang.com/59c9f7ce0001839219034033.png") top center no-repeat; background-size: 100% 100%; }


.w{width: 260px; 

  height: 260px;

  background: url("http://climg.mukewang.com/5a3383c70001f1b702240364.png")  no-repeat;

  position: fixed; right:0;top:50%;margin-top: -130px;margin-right:-35px;}

.e{width: 260px;

height: 260px;

background: url("http://climg.mukewang.com/5a3383d00001a3dd02240364.png") no-repeat;

position: fixed; left: 0;top: 50%; margin-top: -130px;

}


</style>

</head>

<body>

<div class="q">

<div class="w"></div>

<div class="e"></div>

</div>


</body>

</html>

主要就是蓝色的图片,设置了position:fixed; right:0; 但是出来的效果并没有完全靠右,还需要设置margin-right:-35px;才能完全靠右边。但是红色的图片设置了left:0;就直接考左了。怎么会事呢。麻烦老师看看。

写回答

1回答

好帮手慕糖

2018-04-16

你好,1、这里测试图片时可以显示的,不知道说的路径问题是指什么,建议:可以具体描述下。

2、右侧块没有完成靠右是因为图片本身的大小比盒子要小,没有填充慢盒子,可以设置background-size属性。

3、另:大的背景图片没有实现宽度100%,建议:可以把宽度修改为100%。
祝学习愉快~

0

0 学习 · 36712 问题

查看课程