Jump to content

Getting newsletter block form fields to resize just like contact section form fields?

Go to solution Solved by S4B,

Recommended Posts

Posted

I'm using the newsletter block to collect subscriptions. I want the newsletter form field sizing to work exactly the same way as the contact form fields. The contact form first name and last name fields stays together (love that), and along with the email field, they all resize responsively together (love that more).  The newsletter form first name and last name won't stay together and email field length is shorter when the first name and last name fields do stay together. I've tested out some code but just couldn't get the newsletter fields to resize that way.

https://grasshopper-iguana-at8n.squarespace.com/  (pw: cookies).

image.thumb.png.d5848fcb8f35b62b577c049de4665464.png

 

partwide.png.2e5aa106db109826050057dafd403f68.png

  • Replies 4
  • Views 823
  • Created
  • Last Reply

Top Posters In This Topic

Posted
23 minutes ago, Power_Tech22 said:

USE THIS FOR THE CSS
.form-group {
    display: flex; /* Use flexbox layout to align input fields */
    flex-wrap: wrap; /* Allow fields to wrap on smaller screens */
    gap: 16px; /* Space between the fields */
}

.input-field {
    flex: 1 1 100%; /* Default to full width on smaller screens */
    min-width: 200px; /* Set a minimum width for optimal resizing */
    box-sizing: border-box; /* Include padding/border in total width */
}

/* Responsive adjustments */
@media (min-width: 600px) {
    .input-field {
        flex: 1; /* Evenly divide the space */
    }
}

.submit-button {
    flex: 0 0 auto; /* Keep the button its natural size */
    padding: 10px 20px; /* Add some padding to the button */
}

THEN FOR THE HTML
 

<!-- Newsletter Form Structure -->
<div class="newsletter-form">
    <div class="form-group">
        <input type="text" placeholder="First Name" class="input-field" />
        <input type="text" placeholder="Last Name" class="input-field" />
        <input type="email" placeholder="Email" class="input-field" />
        <button type="submit" class="submit-button">Subscribe</button>
    </div>
</div>

<!-- Contact Form Structure (for reference) -->
<div class="contact-form">
    <div class="form-group">
        <input type="text" placeholder="First Name" class="input-field" />
        <input type="text" placeholder="Last Name" class="input-field" />
        <input type="email" placeholder="Email" class="input-field" />
        <button type="submit" class="submit-button">Send</button>
    </div>
</div>
 

Thanks for the quick reply! But this is what I see from a wide to narrow screen. And if possible, I'd like to just modify the existing fields in the newsletter block (if possible, but not opposed to creating the form with html if this is the best way to do it 🙂).

test1.thumb.png.5c92950440957dcec95d173bf9ed8c08.png

test2.thumb.png.ea8835ab296fcb42f54f71bc06efb838.png

test3.png.9fb49097d8728c5f8bc91e67fcef5550.png

test4.png.91c0b8404309373fe6c02d0ab1df8ab8.png

  • 2 weeks later...
  • Solution
Posted
On 9/26/2024 at 2:15 AM, tuanphan said:

cookies

password is incorrect

Thank you, @tuanphan for your offer to help!! I am truly grateful for your willingness to help anyone you can! Fortunately, I was able to figure something out. I actually used AI to write out code for me with the specific behavior I wanted in a generic form. Then I mapped out all of the CSS from the AI code to the Squarespace newsletter form elements. Took some trial and error, and still need to do some very minor tweaks here and there, but I finally got it to work!

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.