Pure CSS Grids with Multi-Column Form
Last Updated :
17 Aug, 2022
Pure CSS is a free and open-source CSS framework. It is a collection of tools for creating web applications and responsive web pages. This was developed by Yahoo and is used to make web pages that are more user-friendly, aesthetically pleasing, and quick. It is a potent replacement for Bootstrap. The creation of pure CSS took the responsive design into account. As a result, we receive responsive layouts that are prebuilt and consistent across all platforms.
Pure CSS Forms is an organized way of taking user information and inputs. We just need to add the class “pure-form” to any <form> element to make a default form. There are various types of forms like the Aligned Form, Stacked Form, and Multi-Column Form (Using Pure Grids). Multi-column forms & responsive multi-column can be created by implementing the Pure Grid and Pure Responsive Grid.
Pure CSS Grids with Multi-Column Form Classes:
- pure-form: This class is used with a form element to create a Pure CSS form group.
- pure-form-stacked: It is used to make the stacked form in which the labels are placed above the input fields.
- pure-g: This class is used to create a Pure CSS grid system.
- pure-u-m-n: This class is used to add the units of the grid system.
Syntax:
<form class="pure-form pure-form-stacked">
<fieldset>
<legend>Legend</legend>
<div class="pure-g">
<div class="pure-u-* pure-u-md-m-n">
<label for="">...</label>
<input type="..." id="..."
class="pure-u-m-n" />
</div>
...
</div>
</fieldset>
</form>
Example 1: This code example demonstrates how we can make a multi-form column that is responsive with the help of Pure Responsive Grids.
HTML
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/pure-min.css">
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/base-min.css">
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/grids-min.css">
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/grids-responsive-min.css">
<link rel="stylesheet" href=
"https://purecss.io/layouts/side-menu/styles.css">
<script src=
"https://purecss.io/js/ui.js">
</script>
</head>
<body>
<div id="main">
<div class="header">
<h1 style="color:green;"> GeeksforGeeks </h1>
<h2>Pure CSS Grids with Multi-Column Form</h2>
</div>
<form class="pure-form pure-form-stacked"
style="margin:3rem;">
<fieldset>
<legend>Submit User Details</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-3">
<label for="multi-first-name">
First Name
</label>
<input type="text" id="multi-first-name"
class="pure-u-23-24" />
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="multi-last-name">
Last Name
</label>
<input type="text" id="multi-last-name"
class="pure-u-23-24" />
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="multi-email">E-Mail</label>
<input type="email" id="multi-email"
class="pure-u-23-24" required="" />
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="multi-city">City</label>
<input type="text" id="multi-city"
class="pure-u-23-24" />
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="multi-state">Domain</label>
<select id="multi-state" class="pure-input-1-2">
<option>DSA</option>
<option>Web Technologies</option>
<option>Competitive Coding</option>
</select>
</div>
</div>
<label for="multi-terms" class="pure-checkbox">
<input type="checkbox" id="multi-terms" />
I've read the terms and conditions
</label>
<button type="submit" class=
"pure-button pure-button-primary">
Submit
</button>
</fieldset>
</form>
</div>
</body>
</html>
Output:
Example 2: The code example demonstrates how we can add all types of form inputs like the grouped ones or the rounded ones to the multi-column layout.
HTML
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/pure-min.css">
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/grids-min.css">
<link rel="stylesheet" href=
"https://unpkg.com/[email protected]/build/grids-responsive-min.css">
<link rel="stylesheet" href=
"https://purecss.io/layouts/side-menu/styles.css">
<script src="https://purecss.io/js/ui.js"></script>
</head>
<body>
<div id="main">
<div class="header">
<h1 style="color: green;">GeeksforGeeks</h1>
<h2>Pure CSS Grids with Multi-Column Form</h2>
</div>
<form class="pure-form pure-form-stacked" style="margin:3rem;">
<fieldset>
<legend>Submit User Details</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-3 pure-u-lg-1-2">
<label for="multi-first-name">First Name</label>
<input type="text" id="multi-first-name"
class="pure-u-23-24 pure-input-rounded" />
</div>
<div class="pure-u-1 pure-u-md-1-3 pure-u-lg-1-2">
<label for="multi-last-name">Last Name</label>
<input type="text" id="multi-last-name"
class="pure-u-23-24 pure-input-rounded" />
</div>
<div class="pure-u-1 pure-u-md-1-3 pure-u-lg-1-2">
<label for="multi-email">E-Mail</label>
<input type="email" id="multi-email"
class="pure-u-23-24 pure-input-rounded" required="" />
</div>
<div class="pure-u-1 pure-u-md-1-3 pure-u-lg-1-2">
<label for="multi-city">City</label>
<input type="text" id="multi-city" class=
"pure-u-23-24 pure-input-rounded" />
</div>
<div class="pure-u-1 pure-u-md-1-3 pure-u-lg-1-2">
<label for="multi-state">Domain</label>
<select id="multi-state" class="pure-input-1-2">
<option>DSA</option>
<option>Web Technologies</option>
<option>Competitive Coding</option>
</select>
</div>
<fieldset class="pure-group pure-u-1 pure-u-md-1-3 pure-u-lg-4-5">
<input type="text" class="pure-input-1-2 pure-input-rounded"
placeholder="Language Preference" />
<input type="text" class="pure-input-1-2 pure-input-rounded"
placeholder="Experience" />
<input type="email" class="pure-input-1-2 pure-input-rounded"
placeholder="Score" />
</fieldset>
</div>
<label for="multi-terms" class="pure-checkbox">
<input type="checkbox" id="multi-terms" />
I've read the terms and conditions
</label>
<button type="submit" class="pure-button pure-button-primary">
Submit
</button>
</fieldset>
</form>
</div>
</body>
</html>
Output:
Reference: https://purecss.io/forms/#multi-column-form-with-pure-grids
Similar Reads
Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read
Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De
5 min read
Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
Steady State Response In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
9 min read
JavaScript Interview Questions and Answers JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as
15+ min read
React Tutorial React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon
8 min read
Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read