1.图片超出浏览器,居中显示。
html结构,图片是1920*590。如果全部显示在1000左右的分辨率的显示屏上就会出现滚动条。解决如下。
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="../css/style.css">
</head>
<body>
<section class="picture" >
<a href="#"><img src="../img/20151209151031_2019_77.jpg" alt=""></a>
</section>
</body>
</html>
css样式 :
.picture a{
display: block;
position: relative;
width: 100%;
overflow: hidden;/*隐藏溢出的部分*/
height: 590px;
}
.picture img {
position: absolute;
height: 590px;/*图的高*/
width: 1920px;/*图的宽*/
left: 50%;
margin-left: -960px;/*图片的宽的一半*/
}
这样左右两边的都隐藏掉了。居中显示。