1 回答

TA貢獻(xiàn)1793條經(jīng)驗(yàn) 獲得超6個(gè)贊
這是標(biāo)記的快速示例。您需要使用 css 進(jìn)行樣式設(shè)置。
html/php
<a href="<?php echo wc_get_cart_url(); ?>" class="basketicon" title="<?php _e( 'View your shopping cart' ); ?>">
<span class="basketicon__icon"></span>
<span class="basketicon__total">
<?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?>
</span>
</a>
CSS/SASS
.basketicon{
margin: 0 30px 0 0;
padding: 0 30px 0 0;
display: inline-flex;
align-items: center;
position: relative;
@media (min-width: $lg){
margin: 0 30px 0 0;
padding: 0 30px 0 0;
}
&::before{
@media (min-width: $lg){
content: '';
position: absolute;
right: -10px;
width: 20px;
height: 1px;
background: #fff;
}
}
&__icon{
&::before{
content: url(../images/basket.svg);
height: 10px;
width: 10px;
display: block;
}
}
&__total{
display: none;
color: #fff;
font-size: rem(16);
margin: 0 0 0 10px;
@media (min-width: $lg){
font-size: rem(12);
display: inline-block;
}
@media (min-width: $xl){
font-size: rem(14);
}
@media (min-width: $xxxl){
font-size: rem(15);
}
}
&:hover,
&:focus{
.basketicon{
&__icon{
&::before{
transform: scale(0.8);
}
}
}
}
}
- 1 回答
- 0 關(guān)注
- 176 瀏覽
添加回答
舉報(bào)