TIL: Form controls can be outside their parent form 1 ▲ Matt Fantinel 71 days ago · Tech · hide · Fediverse post If anything looks wrong, read on the site! Ok, this is maybe something that is widely known (it sure feels like it should be), but it was a gap in my knowledge at least, due to being self-taught: HTML <form> controls don’t have to be inside the <form> tag! All my web dev life, I always thought that any fields of a form necessarily had to be inside the <form> it belongs to, otherwise it’d rely on JavaScript to work, which is gross. Which is how I ended up with structures similar to the one below, from a blog archive page: <form action="/"> <section class="hero"> <!-- Search input and category filters --> </section> <!-- Other blocks like featured posts --> <section class="posts-feed"> <!-- blog posts, pagination, extra filters, etc --> </section> </form> The content in between the hero and posts-feed is flexible and controlled from the CMS, which means it can contain any other components in it. To account for that, I wrapped the entire content of the page in a <form>, so that the… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town