1
我使用這個迷你的價格表:http://codepen.io/joejoinerr/pen/CJAkK添加圖片在塊
我怎樣才能把圖像放在它的上面?就像這樣:
也在這裏定價表的代碼:
HTML:
<div class="pricing">
<div class="price-option price-option--low">
<div class="price-option__detail">
<span class="price-option__cost">$0</span>
<span class="price-option__type">Freeuser</span>
</div>
<a href="#" class="price-option__purchase">Get</a>
CSS:
*,
*:before,
*:after {
box-sizing: border-box;
}
html,
body {
height: 100%
}
body {
background: #454c4f;
font: 1em/1.5 'Droid Sans', sans-serif;
}
.pricing {
@include translate(-49%, -49.1%);
position: absolute;
left: 50%;
top: 50%;
width: 310px;
font-size: 0;
opacity: 1;
transition: opacity .2s ease;
}
.price-option {
display: inline-block;
width: 6.25em;
vertical-align: middle;
margin-right: 0.3125em;
font-size: 16px;
opacity: 1;
transition: opacity .2s ease;
}
.price-option:last-child { margin-right: 0; }
.pricing:hover .price-option { opacity: 0.6; }
.pricing:hover .price-option:hover { opacity: 1; }
.price-option__detail {
padding: 2em 0;
background: white;
text-align: center;
}
.price-option--low .price-option__detail { border-radius: .25em 0 0 0; }
.price-option--mid .price-option__detail { padding: 2.3em 0; border-radius: .25em .25em 0 0; }
.price-option--high .price-option__detail { border-radius: 0 .25em 0 0; }
.price-option__cost,
.price-option__type {
display: block;
}
.price-option__cost {
font-size: 1.5em;
color: #383838;
}
.price-option__type {
font-size: .7em;
text-transform: uppercase;
color: #909090;
}
.price-option__purchase {
position: relative;
display: block;
padding: .6em;
font-size: .875em;
font-weight: bold;
text-align: center;
text-transform: uppercase;
text-decoration: none;
color: rgba(0,0,0,0.6);
}
.price-option--low .price-option__purchase { background: #a7d155; border-radius: 0 0 0 .25em; }
.price-option--mid .price-option__purchase { background: #eada42; border-radius: 0 0 .25em .25em; }
.price-option--high .price-option__purchase { background: #e54e4b; border-radius: 0 0 .25em 0; }
.price-option__purchase:before {
content: '';
position: absolute;
bottom: 100%;
left: 50%;
display: block;
width: 0;
height: 0;
margin-left: -5px;
border-width: 0 5px 5px;
border-style: solid;
}
任何幫助表示讚賞
在定價div包裝器之前添加圖片,然後將其放置得相對較低以滿足您的需求? – 2014-12-09 13:14:35
添加':before':僞元素。 ---->更新了[codepen](http://codepen.io/chipChocolate/pen/QwyZbe)。 – 2014-12-09 13:23:01