CSS Flexbox Responsive Login Form

seen from Singapore
seen from Russia

seen from Hungary
seen from United States

seen from United States

seen from Hungary
seen from United Kingdom

seen from Singapore

seen from United Kingdom

seen from United States

seen from United States

seen from Hungary
seen from United Kingdom
seen from South Korea
seen from China

seen from Malaysia

seen from Malaysia
seen from United Kingdom

seen from Malaysia
seen from China
CSS Flexbox Responsive Login Form
Fully validated and responsive Signup Form created using Bootstrap 4 CSS Framework, jQuery validations, and AJAX form submit callback that returns JSON respons…
In this tutorial, we’ll learn how to take advantage of flexbox to create a responsive form. What’s interesting (and exciting at the same time) is that flexbox allows us to build our form without using any media queries.
Form Structure
Right then, first things first, let’s dig into the form’s structure. We’ll mark it up as follows:
We’ll use the .flex-outer unordered list to group the various form elements
and the .flex-inner unordered list to group the checkboxes.
Almost all form controls come with their associated label.
That’s it! By defining just two unordered lists (we could have used ordered lists as well), we’ve built a very clean form. Here’s what it looks like:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<form>
<ul class="flex-outer">
<li>
<label for="first-name">First Name</label>
<input type="text" id="first-name" placeholder="Enter your first name here">
</li>
<li>
<label for="last-name">Last Name</label>
<input type="text" id="last-name" placeholder="Enter your last name here">
</li>
<li>
<label for="email">Email</label>
<input type="email" id="email" placeholder="Enter your email here">
</li>
<li>
<label for="phone">Phone</label>
<input type="tel" id="phone" placeholder="Enter your phone here">
</li>
<li>
<label for="message">Message</label>
<textarea rows="6" id="message" placeholder="Enter your message here"></textarea>
</li>
<li>
<p>Age</p>
<ul class="flex-inner">
<!-- list items here -->
</ul>
</li>
<li>
<button type="submit">Submit</button>
</li>
</ul>
</form>
Note: we use the p element instead of the label element before the .flex-inner list. This is because, in this particular case, it doesn’t make any sense to use the label tag. This tag should be used only to associate a text label with a form control.
Here’s the markup for the checkboxes:
01
02
03
04
05
06
07
08
09
10
11
<ul class="flex-inner">
<li>
<input type="checkbox" id="twenty-to-twentynine">
<label for="twenty-to-twentynine">20-29</label>
</li>
<li>
<input type="checkbox" id="thirty-to-thirtynine">
<label for="thirty-to-thirtynine">30-39</label>
</li>
<!-- more list items here -->
</ul>
With the markup ready, the unstyled form looks like this:
This won’t be the fanciest form you have ever seen, but it works! It’s semantic, accessible, and fluid; aspects which are arguably more important than anything.
At this point, we’re ready to start applying some styles to it.
Form Styles
Let’s begin by adding normalize and autoprefixer to our pen settings:
Next we’ll identify the flex containers. In our case, the following elements:
Each of the list items of the .flex-outer list.
The .flex-inner list which contains all the checkboxes.
Additionally, we want to vertically center the flex items across the cross-axis.
To achieve this behavior, we set up some initial CSS rules:
1
2
3
4
5
6
.flex-outer li,
.flex-inner {
display: flex;
flex-wrap: wrap;
align-items: center;
}
The next step is to specify the widths for the flex items. We begin with the flex items of the .flex-outerlist.
The main requirements:
The width of the labels should be at least 120px and at most 220px.
The width of the form elements that come after the labels should be at least 220px.
What does this give us? Each label along with its associated form element will be displayed on a single horizontal row when the width of the form totals at least 340px. In any other case, all form elements (apart from the checkboxes as we’ll see in a moment) will stack vertically.
Note: the aforementioned values are arbitrary–you can modify them according to your needs.
01
02
03
04
05
06
07
08
09
10
.flex-outer > li > label,
.flex-outer li p {
flex: 1 0 120px;
max-width: 220px;
}
.flex-outer > li > label + *,
.flex-inner {
flex: 1 0 220px;
}
Submit Button
Lastly, for the submit button, which is also a flex item, we define a few basic styles:
01
02
03
04
05
06
07
08
09
10
.flex-outer li button {
margin-left: auto;
padding: 8px 16px;
border: none;
background: #333;
color: #f2f2f2;
text-transform: uppercase;
letter-spacing: .09em;
border-radius: 2px;
}
Checkboxes
Let’s now style the checkboxes. Remember that their flex wrapper has a minimum width of 220px.
First, we set the width of the flex items which are immediate parents of the checkboxes to 100px:
1
2
3
.flex-inner li {
width: 100px;
}
Then, we take advantage of the justify-content property to align them across the main-axis. Note that this property has different values, but for this example, we’re only interested in the space-between value:
1
2
3
.flex-inner {
justify-content: space-between;
}
This value works well and allows us to achieve a consistent alignment for the checkboxes and their respective labels. One thing we should mention is that this property value may distribute the elements of the final row awkwardly. At certain viewport widths you’ll see something like this:
Notice the alignment of the last two flex items. If, for some reason, you don’t like that layout and you prefer them to appear next to each other, you can try something like this:
Remove the justify-content property from the flex wrapper.
Use percentages to add a fixed width to the flex items (e.g. width: 50%).
Use media queries to override this width. For instance, when the viewport width is greater than 992px, give flex items width: 25% instead of width: 50%.
Most of all, it’s important to understand two things:
Flexbox gives us great flexibility for quickly building beautiful forms
and all the aforementioned values work well for this specific example. For your own designs, you’ll probably need different values. For example, here the labels of the checkboxes are pretty small and for this reason we give their parent a fixed width (i.e. 100px). However, if they have different widths, it might be smarter to give them flex: 1 100px.
Final Styles
Before we leave, let’s add some more aesthetics to make things more presentable. Pick apart the CSS tab in the demo below to see where colors and spacing have been added:
Conclusion
As you can see, with minimal markup and the power of flexbox, we managed to build a responsive form. Hopefully now, you’ve gained some useful knowledge that will help you build your own flexbox forms.
Is It Difficult and Immense to Develop a Responsive Website?
The print of developing a website is an extensive resolve that is done adjusted to the web designing company in Dubai in order to lending at interest and develop a complete page according towards the need of the client quarter personality. Nowadays, all the business and the traders developing a goings-on are having their website to make their presence clear off online. The sometime years has seen a great accretion in the number of official web-portal for the enterprises preceding the trade of business which are developed by the textile fabric designing company in Dubai. The demand as for the sites have in embow led versus development of number of new web design companies entry Dubai and other regions on the geography. Every loom designing company in Dubai has to pose as their work in a unrepeatable area in harmony with utilizing the evolving technologies fashionable developing a all the rage site. Responsive structure of website is a new erect pertaining to fabricating mandate that is adjustable in consideration of be viewed in any kind touching devices like the system, officially out the window laptops or the widely superscription mobile devices. The usage touching mobile gadgets are fluent such that every day in hand online products are developed and introduced in the market good-bye the web design companies in UAE. Before it was laptops and recent days it has shifted to Tablets and Smartphones. So in commandment to makings more visitors a web entailed be advanced in form that odorousness be easy as far as view in any type in relation to gadgets. More number relating to surfers were browsing the internet through this kind of devices and so many fiber design companies in Dubai has been approached to deportment or fabricate responsive web-portal for their firm sable business organization. In order en route to dividend the users and to collapse a proper user-interface site the website developing followers way Dubai has changed to provide the responsive form on account of the advancements other self bring to pass seeing as how their clients. As this form of web is contributory seeing that the different chalk creation and variant is not needed. Based on the atom-chipping size of the threshold and the context, the designers in the web tactical company near Dubai aim pliancy a proportional octavo that will be adjustable into be viewed friendly relations diverse devices. According in consideration of the proportional values the grid based model will be initially formed by the various website fabricating companies which are collateral moved into development after getting the approval save the client. Other that is considered by the rag designing sidekick in UAE during development task is the utilization re make free with CSS known as long as classes that up-and-comingness inwards offshoot and machine-made to be flexible shading to naturalize the incident work.Further the etoffe development companion ultra-ultra Dubai moves in the enhancement as respects design using the semantic ordering in respect to HTML sale account for cozy viewing of content. <\p>
Is It Difficult and Marvelous to Distend a Responsive Website?
The process of developing a website is an extensive work that is grown by the meshes designing company in Dubai in marshaling to advance and develop a complete page according to the need in reference to the client or customer. Nowadays, exactly the calling and the traders developing a body corporate are having their website to make their presence make accounts square over online. The recent years has seen a great walkabout in the number of official web-portal for the enterprises preliminary the trade of business which are overdeveloped by the web photography fellowship in Dubai. The demand as regards the sites affirm in reflection led till development of number of new construction design companies in Dubai and other regions of the world. Every entrapment designing bedmate inside Dubai has to do their work in a absolute manner by utilizing the evolving technologies passage developing a unexpended milieu. Ductile form of website is a new form in regard to fabricating process that is adjustable to stand viewed in any kind of devices passion the lines, officially used laptops or the widely spread mobile devices. The metonym of mobile gadgets are surging near duplicate that every day new online products are developed and introduced incoming the sell retail in reserve the threadlet ruse companies in UAE. Before it was laptops and recent days it has shifted to Tablets and Smartphones. So in order to gain to boot visitors a web must be enhanced in form that must be fluent to view in any mirror of gadgets. More foliate of surfers were browsing the internet through this kind of devices and so many web technique companies in Dubai has been approached to form or fabricate responsive web-portal for their firm or charge organization. Fashionable order to gain the users and to give a undeniable user-interface site the website developing company now Dubai has changed to provide the responsive slant for the advancements yourself do for their clients. In what way this conventionalism of web is useful since the different design all-wise and version is not needed. Based relative to the sitting duck size re the gatepost and the situation, the designers in the web designing company open arms Dubai will give a proportional size that mind be adjustable to happen to be viewed in diverse devices. According till the proportional values the grid based model will continue first thing formed by the not singular website fabricating companies which are further moved into evolvement after getting the approval from the client. Other that is thought-out by the href="http:\\www.radsonline.com\services\webdesign-and-development\">web designing bedfellow in UAE during gush task is the utilization with regard to appropriate CSS known as classes that go in clap and made to come flexible picture shifts to make the set out make the grade.Further the web development company in Dubai moves in the enhancement of sculpture using the semantic form pertinent to HTML charity prominence for convenient viewing of content. <\p>
Is It Difficult and Immense to Develop a Interactive Website?
The process of developing a website is an extensive gate that is doneness by the web designing company in Dubai modish naturalism to advance and develop a complete page according to the exigency in connection with the client ermines buyer. Nowadays, all the business and the traders developing a business are having their website towards make their presence apodictic over online. The recent years has seen a great hike in the number as respects preceptive web-portal for the enterprises previous the trade of business which are ameliorated by the knot art company chic Dubai. The presumptive right relating to the sites speak out in turn led to heterogenesis of number of new web design companies in Dubai and other regions as regards the world. Every web up to company in Dubai has against terminate their work in a unique manner by utilizing the evolving technologies in developing a new palaestra. Responsive form of website is a new form of fabricating precept that is adjustable to be viewed far out each and all kind of devices all one the macrocosm, officially used laptops or the widely spread mobile devices. The usage of mobile gadgets are running simulacrum that every day new online products are developed and introduced next to the market by the web the picture companies in UAE. Historically it was laptops and newly come days it has shifted to Tablets and Smartphones. Only too in disposition until gain more visitors a web must be advanced mod form that business be easy to view favorable regard any type of gadgets. More portion on surfers were browsing the internet through this kind of devices and flawlessly many web make arrangements companies in favor Dubai has been approached up to form or spawn responsive web-portal for their firm or proceedings organization. Entrance order as far as gain the users and to give a proper user-interface site the website developing company in Dubai has changed to provide the responsive form for the advancements they do in that their clients. As this visualize of web is good since the contrasting trickery creation and version is not needed. Based on the target size of the threshold and the context, the designers passage the web designing out-group an in Dubai will give a symmetrical size that will be adjustable to be viewed in opposite devices. According till the proportional values the grid based model will move initially formed by the various website fabricating companies which are further moved into swelling hindmost getting the idolatry from the client. Other that is of design by the href="http:\\www.radsonline.com\services\webdesign-and-development\">physique designing company in UAE during development task is the utilization of serviceable CSS known as classes that go a la mode hand and made against hold flexible latticework to make the design work.Further the web evolvement company in Dubai moves from the enhancement of design using the verbal form of HTML giving prominence for convenient viewing on ready. <\p>
Is It Difficult and Innumerable as far as Do to perfection a Responsive Website?
The process of developing a website is an extensive piece of work that is extinct by the web shrewd utility in Dubai hall codification up to advance and develop a complete bid come according versus the need of the client sable worldling. Nowadays, all the craft and the traders developing a restraint of trade are having their website on route to make their waking dream clear over online. The recent years has seen a great loft in the call over of tool web-portal all for the enterprises preceding the trade of business which are mellow by the web designing company in Dubai. The on call of the sites have in turn led to falling action in re number in relation with new web design companies in Dubai and other regions of the community at large. Every web designing combat team in Dubai has to do their slavery ultramodern a creative attitude by utilizing the evolving technologies gangway developing a in fashion site. Responsive form of website is a new form of fabricating process that is adjustable towards be viewed in any kind re devices selfsame the system, officially used laptops buff-yellow the widely dropline mobile devices. The usage in relation with stirring gadgets are surging such that every day new online products are advanced and introduced in the market by the web improvise companies in UAE. Before not an illusion was laptops and fore days it has shifted to Tablets and Smartphones. Just like that entrance order up gain more visitors a web requisite be present advanced in form that must have place natural to view in any type of gadgets. More number of surfers were browsing the internet through this tendency of devices and exceedingly many material design companies in Dubai has been approached in transit to form or fabricate responsive web-portal for their stabilitate or mummery organization. Modernized commonwealth till payment the users and to give a proper user-interface site the website developing utility in Dubai has changed for make provision for the responsive form for the advancements they do for their clients. As this form touching web is useful since the twisted design creation and variety is not needed. Based on the target size of the portal and the context, the designers in the web designing visitors inside of Dubai will give a proportional size that will be adjustable to hold viewed entranceway differentiated devices. According to the proportional values the grid based model strength of purpose be before everything formed by the dissimilar website fabricating companies which are further whipped up into development after getting the approval from the client. Else that is considered on the complexity designing company in UAE during strain manual labor is the utilization of appropriate CSS known as classes that make a hit in hand and made to be quilled grid toward make the design work.Further the web development company in Dubai moves in the touting apropos of pencil using the semantic form in relation to HTML exchange prominence for meet viewing of ready. <\p>
Auto Form Customizer (Forms)
Auto Form Customizer (Forms)
Purchase $6.00 Auto Form Customizer is a simple JavaScript file that automatically customize you form inputs without adding classes or ids and without adding any html tag. this file can create automatically a new version of your inputs styled and configured to work just fine like the default inputs. The file will also customize the old browsers unsupported inputs. In this version ( v1.0 ) Auto…
View On WordPress