Skip to content

ITP-Jan-25 Cape Town | Jordy Mukandayi | Module-Onboarding | Form-Controls |Week2 #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
70 changes: 59 additions & 11 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,73 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />

<meta
name="description"
content="T-shirt order form, select t-shirt color, and choose size."
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="styles.css" />
<title>T-Shirt Order Form</title>
</head>
<body>
<header>
<h1>Product Pick</h1>
<header class="header">
<h1>T-shirt Pick</h1>
</header>
<main>
<form>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->
<form action="" method="POST">
<div class="label-name">
<label for="name">Name</label>
<input
type="text"
name="name"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to require a min of 2 char for the name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added minlength="2" for require 2 char

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

id="name"
placeholder="Enter full name "
required
minlength="2"
/>
</div>
<div class="label-email">
<label for="email">Email</label>
<input
name="email"
id="email"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to ensure that the email is valid

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed type="text" to type="email"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

type="email"
placeholder="Enter your email"
required
/>
</div>
<div class="label-size">
<label for="size" class="tshirt">T-shirt Size</label>
<select id="size" name="size" required>
<option value="">Select a size</option>
<option value="XS">XS</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>
<option value="XL">XL</option>
<option value="XXL">XXL</option>
</select>
</div>
<div class="radio">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be required

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the select size have the required

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

<div>
<label for="black">Black</label>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The colors also needs to be required.

<input type="radio" name="color" id="black" value="black" />
</div>
<div>
<label for="white">White</label>
<input type="radio" name="color" id="white" value="white" />
</div>
<div>
<label for="blue">Blue</label>
<input type="radio" name="color" id="blue" value="blue" />
</div>
</div>
<button type="submit">Place Order</button>
</form>
</main>
<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h2>By Jordy Mukandayi</h2>
</footer>
</body>
</html>
124 changes: 124 additions & 0 deletions Form-Controls/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/* body { */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete this file

/* margin: 0;
padding: 0;
} */
.header {
display: flex;
flex-direction: column;
text-align: center;
}
h1 {
margin-top: 20px;
margin-bottom: 1px;
font-weight: bold;
font-size: 30px;
}
/* Label-name */
form {
display: block;
flex-direction: column;
width: 600px;
background: #f2f2f2;
border: 1px solid #cccccc;
border-radius: 5px;
margin: 20px auto 40px auto;
}
.label-name {
border-radius: 5px;
padding: 18px 20px;
margin: 8px 0;
background: #f2f2f2;
}
input[type="text"],
input[type="date"],
input[type="email"],
select {
width: 92%;
padding: 12px 20px;
margin: 8px 0;
display: flex;
border-radius: 5px;
border: 1px solid #cccccc;
}
label {
font-weight: bold;
font-size: 20px;
}
/* Email */
.label-email {
padding: 18px 20px;
margin: 8px 0;
background: #f2f2f2;
}
/* T-shirt size */
.tshirt {
display: flex;
justify-content: left;
padding-left: 20px;
}
#size {
display: center;
justify-content: center;
font-size: 15px;
font-weight: 700px;
margin-left: 25px;
}
/* T-shirt color */
.radio {
display: flex;
justify-content: center;
padding: 10px 0;
}
/* Button */
button {
width: 92%;
color: white;
font-weight: 700;
font-size: 20px;
border-radius: 4px;
background: #0019f7;
margin: 8px 26px 20px;
padding: 14px 20px;
display: center;
cursor: pointer;
}
button:hover {
background-color: #926487;
}
/* footer */
h2 {
text-align: center;
}
/* Responsive styles */
@media (max-width: 768px) {
header,
header h1,
header p,
form {
float: none;
text-align: center;
width: 100%;
}
input[type="text"],
input[type="date"],
select {
float: none;
text-align: center;
width: 90%;
display: block;
}
button {
float: none;
text-align: center;
width: 100%;
display: center;
margin-left: 1px;
}
#size {
float: none;
text-align: center;
}
.label-size {
text-align: center;
}
}