图片百分比 html,HTML5 使用百分比定位背景图片

CSS

语言:

CSSSCSS

确定

@charset "UTF-8";

*,

*:before,

*:after {

box-sizing: border-box;

}

body {

font-family: 'Roboto', sans-serif;

background-color: #eee;

}

.wrap {

margin-left: auto;

margin-right: auto;

max-width: 33rem;

background-color: #fff;

padding: 1.5rem;

}

.container {

height: 0;

padding-top: 100%;

background-color: #a1b2c3;

position: relative;

-webkit-transition: all ease-in-out 0.2s;

transition: all ease-in-out 0.2s;

}

.inner {

border: 1px solid #333;

position: absolute;

left: 1.5rem;

top: 1.5rem;

right: 1.5rem;

bottom: 1.5rem;

}

.heading {

margin: 0;

padding: 0;

font-weight: normal;

font-size: 1.3rem;

line-height: 1.5em;

margin-bottom: 0.75rem;

}

.has-bg-image {

background-repeat: no-repeat;

background-image: url("http://lorempixel.com/g/480/480/");

}

.controls {

margin-top: 0.75rem;

color: #666;

}

.ctr-label,

.ctr-slider,

.ctr-info {

display: block;

width: 100%;

}

.ctr-label small {

display: none;

}

.ctr-info {

text-align: right;

}

@media (min-width: 35em) {

.ctr-label,

.ctr-slider,

.ctr-info {

display: inline-block;

vertical-align: middle;

}

.ctr-label {

width: 35%;

}

.ctr-label small {

display: inline;

}

.ctr-slider {

width: 50%;

}

.ctr-info {

width: 10%;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值