欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

根据元素的宽度自适应高度

程序员文章站 2022-07-14 21:26:23
...

###效果图 根据元素的宽度自适应高度 ###布局方式 html <a href="" class="item"> <img alt="" src="images/icon-rule.gif" class="img-full"> </a> css

.item{
			width: 100%;
			display: block;
			height:0;
			padding-bottom: 75%;
			overflow: hidden;
			position: relative;
		}
.item img {
			position: absolute;
			left: 0;
			top:0;
			border-top-left-radius:3px;
			border-top-right-radius:3px;
			min-height: 100%;
		}

转载于:https://my.oschina.net/u/2393989/blog/3026349