让image居中对齐,网页自适应

 1 <div class="page4_content">
 2 
 3 <div class="page4_box">
 4 
 5 <div class="page_bg_16">
 6 
 7  <img src="fuka.jpg">
 8 
 9 </div>
10 
11 </div>
12 
13 </div>
14 
15 
16 
17 .page4_content .page4_box {
18 width: 100%;
19 height: 100%;
20 left: 50%;
21 margin-left: -100%;
22 }
23 .page4_content .page4_box .page_bg_16{
24 display: none;
25 width: 200%;
26 height: 100%;
27 overflow: hidden;
28 position: absolute;
29 text-align: center;
30 }
31 .page4_content .page_bg_16 img, .page4_content .page_bg_4 img {
32 height: 100%;
33 display: inline-block;
34 width: auto;
35 margin: 0 auto;
36 text-align: center;
37 }

让图片根据高度自适应,宽度始终是居中的状态。宽度多余的部分隐藏

猜你喜欢

转载自www.cnblogs.com/shirleyjiang/p/11794144.html