首页 > 代码库 > 静态页面复习--CSS定位练习2
静态页面复习--CSS定位练习2
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> .bg{ height: 384px; background: url(‘images/brick.jpg‘); background-size: 50px 50px; } .fireplace{ height: 384px; width: 256px; position: relative; left:50%; transform: translate(-50%,0); background-color: black; } .topplace{ height: 192px; width:256px; background: url(‘images/inner_cobble_stone.png‘); background-size:50px 50px; } .bottomplace{ height: 192px; width: 256px; background: url(‘images/stonebrick.png‘); background-size: 50px 50px; } .innerplace{ height: 128px; width: 128px; background: url(‘images/inner_cobble_stone.png‘); background-size: 40px 40px; position: relative; top:64px; left:64px; } .ironbars{ height: 64px; width: 128px; background: url(‘images/iron_bars.png‘); background-size: contain; position: relative; transform: translate(-50%,-100%); top:100%; left:50%; } .fire{ height: 128px; width: 128px; background: url(‘images/har.gif‘); background-size: cover; position: absolute; transform: translate(-50%,-100%); top:100%; left:50%; } </style> </head> <body> <div class="bg"> <div class="fireplace"> <div class="topplace"> </div> <div class="bottomplace"> <div class="innerplace"> <div class="fire"> <div class="ironbars"> </div> </div> </div> </div> </div> </div> </body> </html>
静态页面复习--CSS定位练习2
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。