Formulário com background

Segue abaixo o código para se criar um formulário com background.

Veja o formulário em funcionamento aqui.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
    <title>Turn postcard photo into a comment form</title>
 
    <style type="text/css">
 
        .commentForm
 
        {
 
            width: 497px;
 
            height: 324px;
 
            position: relative;
 
            background-image: url( 'comment_form.jpg' );
 
            background-repeat: no-repeat;
 
        }
 
        .commentForm input[type="text"], .commentForm textarea
 
        {
 
            width: 210px;
 
            left: 32px;
 
            position: absolute;
 
            background-repeat: no-repeat;
 
            border-width:0px;
 
            font-weight:bold;
 
            font-family:Arial, Sans-Serif;
 
            font-size:0.9em;
 
        }
 
        .nameField
 
        {
 
            top: 44px;
 
            height: 22px;
 
            background-image: url( 'name_bkg.jpg' );
 
        }
 
        .emailField
 
        {
 
            top: 90px;
 
            height: 22px;
 
            background-image: url( 'email_bkg.jpg' );
 
        }
 
        .websiteField
 
        {
 
            top: 133px;
 
            height: 22px;
 
            background-image: url( 'website_bkg.jpg' );
 
        }
 
        .commentField
 
        {
 
            top: 178px;
 
            height:122px;
 
            background-image: url( 'comment_bkg.jpg' );
 
        }
 
        .sendButton
 
        {
 
               position:absolute;
 
               top:268px;
 
               left:362px;
 
               width:100px;
 
               height:30px;
 
               border:solid 2px #000000;
 
               background-color:#7c6852;
 
               color:#e1cdae;
 
        }
 
    </style>
 
    <script type="text/javascript">
 
        function CommentSent()
 
        {
 
            alert("You successfully pressed the button :)");
 
        }
 
    </script>
 
</head>
 
<body>
 
    <div class="commentForm">
 
        <input type="text" id="nameField" class="nameField" />
 
        <input type="text" id="emailField" class="emailField" />
 
        <input type="text" id="websiteField" class="websiteField" />
 
        <textarea id="commentField" class="commentField" cols="10" rows="5"></textarea>
 
        <input type="submit" id="sendButton" value="Send" class="sendButton" onclick="CommentSent()" />
 
    </div>
 
</body>
 
</html>
Tags: , ,