对联广告为什么不可以紧贴浏览器边框两边 求指教!
来源:4-3 编程练习
子云_
2019-05-17 19:36:34
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>编程练习</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.con{
width: 100%;
height: 4000px;
background: url(http://climg.mukewang.com/59c9f7ce0001839219034033.png) no-repeat center;
margin: 0;
padding: 0;
}
.left{
width: 300px;
height: 500px;
background: url(http://climg.mukewang.com/5a3383c70001f1b702240364.png) no-repeat center;
position: fixed;
right: 0;
top: 50%;
margin-top: -250px;
margin-right: 0px;
}
.right{
width: 300px;
height: 500px;
background: url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png) no-repeat center;
position: fixed;
left: 0;
top: 50%;
margin-top: -250px;
margin-right: 0px;
}
</style>
</head>
<body>
<div class="con">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>
1回答
同学你好, 因为广告栏的宽度设置的太大, 背景图片没有铺满整个容器,左右侧有空白。 导致没有紧贴窗口两侧, 建议修改: 可以适当调整左右两侧div的宽高。例:
如果帮助到了你, 欢迎采纳!
祝学习愉快~~~
相似问题