[Resolved] Use CSS to stack WooCommerce variation labels above input

Home Forums Support [Resolved] Use CSS to stack WooCommerce variation labels above input

Home Forums Support Use CSS to stack WooCommerce variation labels above input

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2400511
    Kevin

    Hi there,

    On single-product.php, WooCommerce variations are displayed in a table.

    This positions the label and the input beside each other.

    On my website, it looks bad on mobile because there is too much crammed in and elements drop underneath.

    Is it possible to stack the label on top of the input?

    I’ve spent a few hours and can’t seem to find the correct CSS.

    If not possible with CSS, is there a template I can edit?

    Please and thanks.

    https://boltmobile.ca/phones-devices/sasktel-apple-iphones/apple-iphone-14-plus/

    #2400677
    Ying
    Staff
    Customer Support

    Hi Kevin,

    Do you mean something like this?
    https://www.screencast.com/t/lo37HExMP

    If so, try this CSS:

    @media (max-width: 768px) {
    label.variable-item-radio-input-wrapper {
        flex-direction: column-reverse;
    }
    
    .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item label {
        display: flex;
        flex-direction: column-reverse;
    }
    }
    #2401784
    Kevin

    Here is what I am trying to achieve:

    Screenshot = https://imgur.com/a/PklkLgz

    Please and thanks πŸ™‚

    #2401842
    Ying
    Staff
    Customer Support

    Oh I see, try this instead:

    @media (max-width: 768px) {
    table.variations tbody tr {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper li .variable-item-radio-input-wrapper {
        display: flex !important;
        flex-wrap: nowrap;
    }
    }
    #2402031
    Kevin

    I was missing the second declaration.

    You are amazing!

    Thank you so much!

    πŸ‘πŸ‘

    #2402062
    Ying
    Staff
    Customer Support

    You are welcome πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.