4-3练习问题
来源:4-3 编程练习
xxxxxbilibli
2018-03-14 19:41:29
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> *{margin:0; padding:0; } .bg{ width:100%; height:4033px; background:url(http://climg.mukewang.com/59c9f7ce0001839219034033.png) no-repeat center; /*position:relative;*/ } .one{ width:220px; height:380px; background:url(http://climg.mukewang.com/5a3383c70001f1b702240364.png) no-repeat; position:fixed; right:0; top:50%; margin-top:-190px; } .two{ width:220px; height:380px; background:url(http://climg.mukewang.com/5a3383d00001a3dd02240364.png) no-repeat; position:fixed; left:0; top:50%; margin-top:-190px; } </style> </head> <body> <div class="bg"> <div class="one"></div> <div class="two"></div> </div> </body> </html>
注释那行代码,通常会不会用到,还是说只相对于网页来定位。
2回答
如果是作为结构块的话,用img标签,如果是作为背景的话,就用背景图片。
你的代码总建议one和two部分要用img标签,bg就用背景颜色来设置。
祝学习愉快!
xxxxxbilibli
提问者
2018-03-14
还有一个问题就是,像上面这张图片通常是用<img>来添加还是在内联样式上去添加