Last week we started making the very neat header section. This article was very popular (we got a lot of reviews). So today I decided to continue begun design. Today we look at the most basic elements of a page such as blocks and forms. I think that if we make all the blocks with the same styles – it would be boring, so (for a change), I prepared four types of blocks with custom headers and footers. And, as a demonstration of the form design – I made the contact form. Now, this is complete design of a single page.
Before we start, I would like to show you what we are going to build today:

[sociallocker]
[/sociallocker]
Now, let’s download the sources and start coding !
Step 1. HTML
In the beginning, we have to add our main section with all mentioned elements:
index.html
07 | <h3 class="head">Header</h3> |
08 | <div>Some extra content</div> |
09 | <h3 class="foot">Footer</h3> |
12 | <h3 class="head head_a">Header A</h3> |
13 | <div>Some extra content</div> |
14 | <h3 class="foot foot_a">Footer A</h3> |
16 | <div class="block block_a"> |
17 | <h3 class="head">Header</h3> |
18 | <div>Block A: Some extra content</div> |
19 | <h3 class="foot">Footer</h3> |
21 | <div class="block block_b"> |
22 | <h3 class="head">Header</h3> |
23 | <div>Block B: Some extra content</div> |
24 | <h3 class="foot">Footer</h3> |
26 | <div class="block block_c"> |
27 | <h3 class="head">Header</h3> |
28 | <div>Block C: Some extra content</div> |
29 | <h3 class="foot">Footer</h3> |
35 | <h3 class="head head_b">Header B</h3> |
36 | <div>Some extra content</div> |
37 | <h3 class="foot foot_b">Footer B</h3> |
40 | <h3 class="head head_c">Header C</h3> |
41 | <div>Some extra content</div> |
42 | <h3 class="foot foot_c">Footer C</h3> |
45 | <h3 class="head head_b">Contact us block</h3> |
49 | <legend>Contact us form</legend> |
50 | <p><label for="name">Your name:</label> <input type="text" id="name" value=""></p> |
51 | <p><label for="email">Your email:</label> <input type="text" id="email" value=""></p> |
52 | <p><label for="text">Message:</label><textarea id="text" cols="33" rows="4"></textarea></p> |
53 | <input type="submit" value="Submit"> |
As you see – everything is very easy. There are only 2 columns in the main section and one footer element. And, there are various blocks in every section. By default, if you like to build a block – you have to use ‘block’ as a class name, if you like to change design of this block – you can add another class name (block_a, block_b or block_c). It will paint your block into different colors. You can also use headers and footers in your blocks (H3 elements with a class name ‘head’ or ‘foot’). And again, there are several classes available to customize headers or footers (head_a, head_b, head_c, foot_a, foot_b and foot_c). In the end – you can see the ordinary contact form.
Step 2. CSS
css/main.css
And now, the most important step – stylization. First of all – main layout styles (for columns):
Here are styles for our custom blocks:
03 | background: -webkit-linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
04 | background: -moz-linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
05 | background: linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
06 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F7F7F7', endColorstr='#F4F4F4',GradientType=0 ); |
07 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.2); |
09 | border-radius: 5px 5px 5px 5px; |
12 | box-shadow: 0 1px 0 #FFFFFF inset; |
17 | .block_a, .block_b, .block_c { |
18 | box-shadow: 0 1px 0 transparent inset; |
21 | background: -webkit-linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
22 | background: -moz-linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
23 | background: linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
24 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F1F1F1', endColorstr='#ECEBEC',GradientType=0 ); |
27 | background: -webkit-linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
28 | background: -moz-linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
29 | background: linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
30 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#55A6F1', endColorstr='#3F96E5',GradientType=0 ); |
33 | background: -webkit-linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
34 | background: -moz-linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
35 | background: linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
36 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5B5D63', endColorstr='#4D5055',GradientType=0 ); |
42 | text-shadow: 0 1px 0 #FFFFFF; |
48 | text-shadow: 0 1px 0 #FFFFFF; |
51 | .block .head_a, .block .head_b, .block .head_c { |
52 | border-bottom: 1px solid #D1D1D1; |
53 | border-radius: 5px 5px 0 0; |
54 | box-shadow: 0 1px 0 #FFFFFF inset; |
55 | margin: -20px -20px 10px; |
56 | padding: 13px 15px 11px; |
58 | .block .foot_a, .block .foot_b, .block .foot_c { |
59 | border-radius: 0 0 5px 5px; |
60 | border-top: 1px solid #D1D1D1; |
61 | box-shadow: 0 1px 0 #FFFFFF inset; |
62 | margin: 10px -20px -20px; |
63 | padding: 13px 15px 11px; |
65 | .block .head_a, .block .foot_a { |
66 | background: -webkit-linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
67 | background: -moz-linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
68 | background: linear-gradient(#F1F1F1, #ECEBEC) repeat scroll 0 0 transparent; |
69 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F1F1F1', endColorstr='#ECEBEC',GradientType=0 ); |
71 | .block .head_b, .block .foot_b { |
72 | background: -webkit-linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
73 | background: -moz-linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
74 | background: linear-gradient(#55A6F1, #3F96E5) repeat scroll 0 0 transparent; |
75 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#55A6F1', endColorstr='#3F96E5',GradientType=0 ); |
76 | box-shadow: 0 1px 0 #3F96E5 inset; |
78 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); |
80 | .block .head_c, .block .foot_c { |
81 | background: -webkit-linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
82 | background: -moz-linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
83 | background: linear-gradient(#5B5D63, #4D5055) repeat scroll 0 0 transparent; |
84 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5B5D63', endColorstr='#4D5055',GradientType=0 ); |
85 | box-shadow: 0 1px 0 #4D5055 inset; |
87 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); |
89 | .block_b .head, .block_c .head, |
90 | .block_b .foot, .block_c .foot, |
91 | .block_b > div, .block_c > div { |
93 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); |
Finally, we need is to define styles for our ‘contact us’ form:
03 | background: none repeat scroll 0 0 #F1F1F1; |
04 | border: 1px solid #CCCCCC; |
05 | border-radius: 5px 5px 5px 5px; |
06 | box-shadow: 0 1px 0 #FFFFFF; |
18 | .main form input, .main form select, .main form textarea { |
19 | background-color: #F9F9F9; |
20 | border: 1px solid #CCCCCC; |
21 | border-radius: 4px 4px 4px 4px; |
22 | box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05) inset, 0 1px 0 #FFFFFF; |
26 | text-shadow: 0 1px 0 #FFFFFF; |
28 | .main form input[type="text"], .main form input[type="password"], .main form select, .main form textarea { |
34 | .main form input[type="text"]:focus, .main form input[type="password"]:focus, .main form select:focus, .main form textarea:focus { |
35 | background: none repeat scroll 0 0 #FFFFFF; |
40 | .main form button, .main form input[type="button"], .main form input[type="submit"] { |
41 | background: -webkit-linear-gradient(to bottom, #F9F9F9, #F7F7F7) repeat scroll 0 0 transparent; |
42 | background: -moz-linear-gradient(to bottom, #F9F9F9, #F7F7F7) repeat scroll 0 0 transparent; |
43 | background: linear-gradient(to bottom, #F9F9F9, #F7F7F7) repeat scroll 0 0 transparent; |
44 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F9F9F9', endColorstr='#F7F7F7',GradientType=0 ); |
45 | border-color: #E0E0E0 #E0E0E0 #CDCDCD; |
47 | border-radius: 4px 4px 4px 4px; |
50 | box-shadow: 0 1px 0 #FFFFFF inset; |
55 | .main form button:hover, .main form input[type="button"]:hover, .main form input[type="submit"]:hover { |
56 | background: -webkit-linear-gradient(to bottom, #59A8F3, #479CEB) repeat scroll 0 0 transparent; |
57 | background: -moz-linear-gradient(to bottom, #59A8F3, #479CEB) repeat scroll 0 0 transparent; |
58 | background: linear-gradient(to bottom, #59A8F3, #479CEB) repeat scroll 0 0 transparent; |
59 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#59A8F3', endColorstr='#479CEB',GradientType=0 ); |
60 | border-color: #3990DB #3990DB #2F78B7; |
63 | box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset; |
65 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); |
67 | .main form button:active, .main form input[type="button"]:active, .main form input[type="submit"]:active { |
68 | background: -webkit-linear-gradient(to bottom, #3F96E5, #55A6F1) repeat scroll 0 0 transparent; |
69 | background: -moz-linear-gradient(to bottom, #3F96E5, #55A6F1) repeat scroll 0 0 transparent; |
70 | background: linear-gradient(to bottom, #3F96E5, #55A6F1) repeat scroll 0 0 transparent; |
71 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3F96E5', endColorstr='#55A6F1',GradientType=0 ); |
72 | border-color: #3990DB #3990DB #2F78B7; |
75 | box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset; |
77 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3); |
If you want to put something into a footer, you can use next styles for footer:
03 | background: -webkit-linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
04 | background: -moz-linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
05 | background: linear-gradient(#F7F7F7, #F4F4F4) repeat scroll 0 0 padding-box transparent; |
06 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F7F7F7', endColorstr='#F4F4F4',GradientType=0 ); |
07 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.2); |
09 | border-radius: 5px 5px 5px 5px; |
12 | box-shadow: 0 1px 0 #FFFFFF inset; |
22 | text-shadow: 0 1px 0 #FFFFFF; |
Conclusion
That’s all. I hope that we have just made a real nice example for our growing experience. I’m sure that it will be very useful for you. Good luck and welcome back.