父级:
div {
width: 100%;
padding-bottom:60%;
//如果要正方形:
/*
width: 100%;
padding-bottom:100%;
*/
position:relative;
}
子级:
img {
width: 100%;
height: 100%;
position: absolute;
}
父级:
div {
width: 100%;
padding-bottom:60%;
//如果要正方形:
/*
width: 100%;
padding-bottom:100%;
*/
position:relative;
}
子级:
img {
width: 100%;
height: 100%;
position: absolute;
}