-
Notifications
You must be signed in to change notification settings - Fork 385
/
surveyform.html
165 lines (150 loc) · 4.38 KB
/
surveyform.html
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
154
155
156
157
158
159
160
161
162
163
164
165
//A basic survey form//
//It contains beginners code for web development.//
<!DOCTYPE HTML>
<link rel="stylesheet" href="styles.css">
<body>
<header>
<section>
<em> <h1 id="title">Favourite food survey</h1></em>
<div>
<p id="description">A food survey will help you in better assessment of your eating habits thus you can kick-start your approach towards healthy consumption of nutrients</p>
</div>
</section>
</header>
<main>
<form id="survey-form">
<section="survey-information">
<!--identification-fields-->
<label for="name" id="name-label"><strong>*Name:</strong></label>
<input id="name" type="text" placeholder="enter your name" required>
<label for="email" id="email-label"><strong>*E-mail:</strong></label>
<input id="email" type="email" placeholder="enter your email" required>
<label for ="number" id="number-label"><strong>*Age:</strong></label>
<input id="number" type="number" placeholder="enter your age" min=18 max=90 required>
<!--which option best describes your taste-->
<label for="dropdown"><strong>Which option best describes your taste</strong></label>
<select id="dropdown" form="survey-from">
<option value="disabled selected">Select an option</option>
<option value="vegetables">Vegetables</option>
<option value="fruits">Fruits</option>
<option value="junk-food">Junk-food</option>
<option value="others">Others</option>
</select>
<!--What do you prefer to eat?-->
<label for= describeyoureslf><strong>How would you like to describe yourself:</strong></label>
<fieldset id="describeyourself">
<label for="r_vegetarian"><input type="radio" name="describeyourself" id="r_vegetarian" value="vegetarian" required>Vegetarian</label>
<label for="r_non-vegetarian"><input type="radio" name="describeyourself" id="r_non-vegetarian" value="non-vegetarian" required>Non-Vegetarian</label>
</fieldset>
<!--Qualities needed in your favourite food-->
<label for="qualitiesneeded"><strong>Qualities needed in your favourite food:</strong></label>
<fieldset id="qualitiesneeded">
<legend><em>Check all that apply</em></legend>
<label for="spicy"><input id="spicy" type="checkbox" name="qualities-check" value="spicy">Spicy</label>
<label for="sweet"><input id="sweet" type="checkbox" name="qualities-check" value="sweet">Sweet</label>
<label for="sour"><input id="sour" type="checkbox" name="qualities-check" value="sour">Sour</label>
<label for="salty"><input id="salty" type="checkbox" name="qualities-check" value="salty">Salty</label>
</fieldset>
<!--Any comments or suggestions-->
<label for="comments"><strong>Any comments or suggestions</strong></label>
<textarea style="height:50px;resize:vertical;" id="comments" placeholder="enter a comment"></textarea>
</section>
<!-- submit -->
<button id="submit">submit</button>
</form>
</main>
</body>
#body {
--background-c: hsl(210, 45%, 60%);
background-color: var(--background-c, lightgray);
display: flex;
flex-direction: column;
font-family: "Raleway", Helvetica, sans-serif;
}
@ media (max-width: 400px) {
body {
font-size: 13px;
}
}
h1 {
margin-bottom: 5px;
}
header {
padding-bottom: 15px;
position: fixed;
background-color: var(--background-c, lightgray);
width: 100%;
z-index: 1;
top: 0%;
}
main {
background-color: hsl(200, 60%, 100%);
height: 100%;
max-width: 900px;
margin: auto;
margin-bottom: 80px;
padding-bottom: 10px;
padding-top: 5px;
position: relative;
top: 80px;
}
@media (max-width: 400px) {
main {
top: 65px;
}
}
.title-text {
margin: auto;
margin-top: -5px;
text-align: center;
}
#description {
margin-top: 10px;
}
#survey-form {
display: flex;
flex-direction: column;
align-items: center;
}
#survey-fields {
margin-left: 10%;
margin-right: 10%;
margin-top: 10px;
margin-bottom: 10px;
display: grid;
grid-gap: 10px;
}
@media (max-width: 600px) {
#survey-fields {
grid-template-columns: 1fr;
}
label {
text-align: left;
}
}
@media (min-width: 600px) {
#survey-fields {
grid-template-columns: 1fr 1fr;
}
label {
text-align: right;
}
}
fieldset {
display: flex;
flex-direction: column;
align-items: flex-start;
border: 0;
min-width: 100%;
}
fieldset label:hover {
font-weight: bold;
}
#submit {
margin: auto;
background-color: var(--background-c, lightgray);
border-radius: 8px;
padding: 5px 12px 5px 12px;
margin-top: 5px;
font-size: 85%;
}