小编I. *_*ros的帖子

有没有办法在woocommerce结账上“浮动标签”?(如 Shopify)

我试图通过在用户关注某个输入时为标签设置动画来复制我的 WooCommerce 结账页面中 Shopify 结账的体验,就像这样:

浮动标签 - 来自 Matt D. Smith 的图片

我试过使用 input:focus ~ 标签,但它不起作用,因为默认的 WooCommerce 输入是在一个跨度 (.woocommerce-input-wrapper) 内,如下所示:

<!-- The basic markup for each input -->
<p class="form-row form-row-first validate-required" id="billing_first_name_field" data-priority="10">
    <label for="billing_first_name" class="">Nombre&nbsp;<abbr class="required" title="obligatorio">*</abbr></label>
    <span class="woocommerce-input-wrapper">
        <input type="text" class="input-text " name="billing_first_name" id="billing_first_name" placeholder="" value="" autocomplete="given-name">
    </span>
</p>

<!-- CSS -->
<style>
.woocommerce-billing-fields__field-wrapper .form-row{
    position: relative;
}
.woocommerce-billing-fields__field-wrapper .form-row label{
    position: absolute;
    top: 11px;
    left: 11px;
    padding: 0;
    color: #808080;
    transition: .35s;
}
.woocommerce-billing-fields__field-wrapper .form-row input:focus ~ label{
    top: -8px;
    font-size: 12px;
    font-weight: …
Run Code Online (Sandbox Code Playgroud)

css wordpress woocommerce

6
推荐指数
1
解决办法
640
查看次数

标签 统计

css ×1

woocommerce ×1

wordpress ×1