CSS3 Form Design – Vintage

Tutorials

Today I prepared great CSS3 styles for forms in vintage style. You can see here styles of most necessary html form elements: text field, selector, checkbox, radio, button, file, textarea and submit button. I hope that I’m not in vain spent the whole evening. It is possible that it will be whole set of styles for your website. Now, let check it.

Final Result

CSS3 Form Design - Vintage

Live Demo
download result

So, lets start


Step 1. HTML

Our form contains all the most of possible form elements:

index.html

01 <form action="#" method="post">
02     <fieldset>
03         <ul>
04             <li>
05                 <label for="name">Name</label>
06                 <input type="text" name="name">
07             </li>
08             <li>
09                 <label for="email">Email</label>
10                 <input type="text" name="email">
11             </li>
12         </ul>
13     </fieldset>
14     <fieldset>
15         <ul>
16             <li>
17                 <label for="text">Text Field</label>
18                 <input type="text" class="required" name="text">
19             </li>
20             <li>
21                 <label for="selector">Selector</label>
22                 <div class="selector">
23                     <span style="-moz-user-select: none;">Please Select...</span>
24                     <select class="selectors" name="selector">
25                         <option value="" selected="">Please Select...</option>
26                         <option>Option 1</option>
27                         <option>Option 2</option>
28                         <option>Option 3</option>
29                         <option>Option 4</option>
30                         <option>Option 5</option>
31                     </select>
32                 </div>
33             </li>
34             <li>
35                 <label for="selector">Disabled</label>
36                 <div class="selector disabled">
37                     <span></span>
38                     <select class="selectors" name="selector"></select>
39                 </div>
40             </li>
41             <li>
42                 <label for="checkbox">Checkbox active</label>
43                 <div class="checker">
44                     <span class=""></span>
45                     <input type="checkbox" name="checkbox" />
46                 </div>
47                 <label for="checkboxc">Checkbox checked</label>
48                 <div class="checker">
49                     <span class="checked"></span>
50                     <input type="checkbox" name="checkboxc" />
51                 </div>
52             </li>
53             <li>
54                 <label for="radio">Radio checked</label>
55                 <div class="radio">
56                     <span class="checked"></span>
57                     <input type="radio" name="radio" value="radio1">
58                 </div>
59                 <label for="radio2">Radio unchecked</label>
60                 <div class="radio">
61                     <span></span>
62                     <input type="radio" name="radio2" value="radio2">
63                 </div>
64             </li>
65             <li>
66                 <label for="button">Buttons</label>
67                 <div class="button"><span style="-moz-user-select: none;">Button 1</span></div>
68                 <div class="button"><span style="-moz-user-select: none;">Button 2</span></div>
69                 <div class="button disabled"><span style="-moz-user-select: none;">Button 3</span></div>
70             </li>
71             <li>
72                 <label for="file">File</label>
73                 <div class="uploader">
74                     <span style="-moz-user-select: none;" class="filename">Please select file</span>
75                     <span style="-moz-user-select: none;" class="action">Upload</span>
76                     <input type="file" name="file" />
77                 </div>
78             </li>
79             <li>
80                 <label for="textarea">Textarea</label>
81                 <textarea name="textarea"></textarea>
82             </li>
83             <li>
84                 <input type="submit" name="submit">
85             </li>
86         </ul>
87     </fieldset>
88 </form>

Step 2. CSS

Now, its time to style our form. Don’t forget to include our CSS file in the head section of the result page.

css/forms.css

001 @font-face {
002         font-family:'ClarendonRoman';
003         src:url('../font/clarebtrom-webfont.ttf'format('truetype');
004 }
005 form {
006         background-color:#fff;
007         overflow:hidden;
008         width:465px;
009         margin:30px auto;
010         padding:10px;
011 }
012 form label {
013         font:13px "ClarendonRoman", Georgia, Times, serif;
014         color:#525250;
015         letter-spacing:2px;
016         text-transform:uppercase;
017         float:left;
018         position:relative;
019         top:4px;
020 }
021 form ul li {
022         padding-top:10px;
023         clear:both;
024         overflow:hidden;
025 }
026 form select,form input {
027         float:right;
028 }
029 form input {
030         border-bottom:1px dashed #989895;
031         border-right:none;
032         border-left:none;
033         border-top:none;
034         color:#4f4f4f;
035         background:none;
036         outline:none;
037         position:relative;
038         font:16px "SeanRegular"Courier New, Courier New, Courier6monospace;
039         letter-spacing:1px;
040 }
041 form input:focus {
042         border-bottom:1px dashed #000;
043         -webkit-transition:border 0.3s ease-in;
044         -moz-transition:border 0.3s ease-in;
045         -o-transition:border 0.3s ease-in;
046         transition:border 0.3s ease-in;
047 }
048 form input[type="text"] {
049         width:300px;
050 }
051 fieldset {
052         border:0;
053         border-bottom:1px solid #A7A7A4;
054         margin-bottom:10px;
055         padding:10px;
056 }
057 textarea {
058         margin-top:4px;
059         width:445px;
060         height:150px;
061         border:none;
062         background:none;
063         outline:none;
064         resize:none;
065         overflow:auto;
066         color:#4f4f4f;
067         font:16px "SeanRegular"Courier New, Courier New, Courier6monospace;
068         letter-spacing:1px;
069         float:left;
070         display:block;
071 }
072 form input[type="submit"] {
073         cursor:pointer;
074         background:url(../images/submit.png) no-repeat;
075         width:445px;
076         height:86px;
077         border:none;
078         text-indent:-9999px;
079         position:relative;
080         bottom:10px;
081 }
082 form input[type="submit"]:hover {
083         background-position:0 -86px;
084 }
085 div.selector,div.selector span,div.checker span,div.radio span,div.uploader,div.uploader span.action,div.button,div.button span {
086         background-image:url(../images/sprite.png);
087         background-repeat:no-repeat;
088         -webkit-font-smoothing:antialiased;
089 }
090 .selector,.radio,.checker,.uploader,.button,.selector *,.radio *,.checker *,.uploader *,.button * {
091         margin:0;
092         padding:0;
093 }
094 .selector select:focus, .radio input:focus, .checker input:focus, .uploader input:focus {
095         outline0;
096 }
097 input.text,input.password,textarea {
098         font-size:12px;
099         font-family:"ClarendonRoman", Georgia, Times, serif;
100         font-weight:400;
101         color:#777;
102         border-top:solid 1px #aaa;
103         border-left:solid 1px #aaa;
104         border-bottom:solid 1px #ccc;
105         border-right:solid 1px #ccc;
106         -webkit-border-radius:3px;
107         -moz-border-radius:3px;
108         border-radius:3px;
109         outline:0;
110         padding:3px;
111 }
112 input.text:focus,input.password:focus,textarea:focus {
113         border-color:#999;
114 }
115 div.selector {
116         background-position:-483px -130px;
117         float:right;
118         font:12px "ClarendonRoman",Georgia,Times,serif;
119         height:26px;
120         left:7px;
121         overflow:hidden;
122         padding-left:10px;
123         position:relative;
124         width:300px;
125 }
126 div.selector select {
127         background:none;
128         border:medium none;
129         font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
130         font-size:12px;
131         height:25px;
132         left:0;
133         opacity:0;
134         position:absolute;
135         top:0;
136         width:300px;
137 }
138 div.selector span {
139         cursor:pointer;
140         background-position:right 0;
141         height:26px;
142         line-height:26px;
143         display:block;
144         float:left;
145         overflow:hidden;
146         text-overflow:ellipsis;
147         white-space:nowrap;
148         width:268px;
149         text-shadow:0 1px 0 #fff;
150         color:#636363;
151         padding:0 25px 0 2px;
152 }
153 div.selector:active {
154         background-position:-483px -156px;
155 }
156 div.selector:active span {
157         background-position:right -26px;
158 }
159 div.selector:hover {
160         background-position:-483px -182px;
161 }
162 div.selector:hover span {
163         background-position:right -52px;
164 }
165 div.selector:hover:active {
166         background-position:-483px -208px;
167 }
168 div.selector:hover:active span {
169         background-position:right -78px;
170 }
171 div.selector.disabled {
172         background-position:-483px -234px;
173 }
174 div.selector.disabled span {
175         color:#bbb;
176         background-position:right -104px;
177 }
178 div.checker {
179         float:left;
180         height:19px;
181         margin-right:10px;
182         margin-top:4px;
183         position:relative;
184         width:19px;
185 }
186 div.checker input {
187         background:none;
188         display:inline-block;
189         height:19px;
190         opacity:0;
191         width:19px;
192 }
193 div.checker span {
194         background-position:0 -260px;
195         display:block;
196         float:left;
197         height:19px;
198         text-align:center;
199         width:19px;
200 }
201 div.checker:active span {
202         background-position:-19px -260px;
203 }
204 div.checker:hover span {
205         background-position:-38px -260px;
206 }
207 div.checker:active:hover span {
208         background-position:-57px -260px;
209 }
210 div.checker span.checked {
211         background-position:-76px -260px;
212 }
213 div.checker:active span.checked {
214         background-position:-95px -260px;
215 }
216 div.checker:hover span.checked {
217         background-position:-114px -260px;
218 }
219 div.checker:hover:active span.checked {
220         background-position:-133px -260px;
221 }
222 div.radio {
223         width:18px;
224         height:18px;
225         position:relative;
226         float:left;
227         margin-top:4px;
228         margin-right:10px;
229 }
230 div.radio input {
231         width:18px;
232         height:18px;
233         opacity:0;
234         text-align:center;
235         display:inline-block;
236         background:none;
237 }
238 div.radio span {
239         height:18px;
240         width:18px;
241         background-position:0 -279px;
242         display:block;
243         float:left;
244         text-align:center;
245 }
246 div.radio:active span {
247         background-position:-18px -279px;
248 }
249 div.radio:hover span {
250         background-position:-36px -279px;
251 }
252 div.radio:active:hover span {
253         background-position:-54px -279px;
254 }
255 div.radio span.checked {
256         background-position:-72px -279px;
257 }
258 div.radio:active span.checked {
259         background-position:-90px -279px;
260 }
261 div.radio:hover span.checked {
262         background-position:-108px -279px;
263 }
264 div.radio:hover:active span.checked {
265         background-position:-126px -279px;
266 }
267 div.uploader {
268         background-position:0 -297px;
269         height:28px;
270         position:relative;
271         float:right;
272         overflow:hidden;
273         width:303px;
274         margin-bottom:20px;
275         margin-left:23px;
276         cursor:pointer;
277 }
278 div.uploader span.action {
279         background-position:right -409px;
280         height:24px;
281         line-height:24px;
282         float:left;
283         display:inline;
284         overflow:hidden;
285         cursor:pointer;
286         width:124px;
287         text-align:center;
288         text-shadow:#fff 0 1px 0;
289         background-color:#f9f9f5;
290         font:bold 12px/24px "ClarendonRoman", Georgia, Times, serif;
291         color:#636363;
292         padding:2px 0;
293 }
294 div.uploader span.filename {
295         height:24px;
296         line-height:24px;
297         float:left;
298         display:block;
299         overflow:hidden;
300         text-overflow:ellipsis;
301         white-space:nowrap;
302         cursor:default;
303         font-family:Georgia, "Times New Roman", Times, serif;
304         font-style:italic;
305         color:#777;
306         width:157px;
307         font-size:11px;
308         margin:2px 0 2px 2px;
309         padding:0 10px;
310 }
311 div.uploader:hover {
312         background-position:0 -353px;
313 }
314 div.uploader:hover span.action {
315         background-position:right -437px;
316 }
317 div.uploader:active span.action {
318         background-position:right -465px;
319 }
320 div.uploader:focus:active span.action {
321         background-position:right -493px;
322 }
323 div.uploader input {
324         width:303px;
325         opacity:0;
326         position:absolute;
327         top:0;
328         right:0;
329         bottom:0;
330         float:right;
331         height:25px;
332         border:none;
333         cursor:default;
334 }
335 div.button button,div.button input {
336         position:absolute;
337 }
338 div.button {
339         background-position:0 -523px;
340         cursor:pointer;
341         position:relative;
342         display:-moz-inline-block;
343         display:inline-block;
344         height:30px;
345 }
346 div.button span {
347         background-position:right -643px;
348         display:-moz-inline-block;
349         display:inline-block;
350         font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;
351         font-size:12px;
352         font-weight:700;
353         height:22px;
354         letter-spacing:1px;
355         line-height:1;
356         margin-left:13px;
357         padding-left:2px;
358         padding-right:15px;
359         padding-top:8px;
360         text-align:center;
361         text-transform:uppercase;
362 }
363 div.button:focus,div.button:hover {
364         background-position:0 -553px;
365 }
366 div.button:focus span,div.button:hover span {
367         background-position:right -673px;
368 }
369 div.button.active,div.button:active {
370         background-position:0 -583px;
371 }
372 div.button.active span,div.button:active span {
373         background-position:right -703px;
374         color:#555;
375 }
376 div.button.disabled,div.button:disabled {
377         background-position:0 -613px;
378 }
379 div.button.disabled span,div.button:disabled span {
380         background-position:right -733px;
381         color:#bbb;
382         cursor:default;
383 }

I hope that I was able to cover all necessary styles. These styles should work well in most of popular browsers.


Live Demo
download result

Conclusion

If you like our result – don’t forget to vote up, thanks in advance. You are free to modify our result and use it at your websites. Good luck!

Rate article