Magento 2 Checkout – How to Add Custom CSS Class in Shipping Address Form

checkoutknockoutjslayoutmagento2template

Want two input fields in one Line on checkout page. Looks like it is binded by knockoutjs. Didn't figure out where to add custom classes. Looked into so many files (Magento_Ui and Magento_Checkout) but didn't found anything to change the classes. Please help me out in making the following shipping address template.

enter image description here

Best Answer

Enter the css code in custom.css to achieve design mention in question image (checkout shipping fields). It will make all fields to half except Street Address

.checkout-index-index .form-shipping-address #shipping-new-address-form {
            .field {
                &:nth-child(2n+1) {
                    width: 49%;
                    float: left;
                }
                &:nth-child(2n) {
                    width: 49%;
                    float: right;
                }
            }
            fieldset {
                width: 100% !important;
                div.field {
                    width: 100% !important;
                }
            }
        }