Skip to content
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 63 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,65 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<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="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<h1>Product 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>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
</footer>
</body>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form control</title>
<link rel="stylesheet" href="style.css" />
<meta name="description" content="F" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<fieldset>
<legend>Personal Information</legend>
<label for="name">Name:</label>
<input
type="text"
id="name"
name="name"
pattern="^\s*(\S\s*){2,}$"
required
title="Please enter at least 2 characters"
/>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required />
</fieldset>

<fieldset>
<legend>Please select your color</legend>

<input type="radio" id="black" name="color" value="Black" />
<label for="black">Black</label>

<input type="radio" id="beige" name="color" value="Beige" />
<label for="beige">Beige</label>

<input type="radio" id="red" name="color" value="Red" />
<label for="red">Red</label>
</fieldset>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can currently submit this form without selecting a colour - please amend

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't think we had to add color only selected was needed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have fixed with required.


<fieldset>
<legend>Please select a size</legend>

<label for="size">Choose a size:</label>
<select name="size" id="size" required>
<option value="">-- Please choose an option --</option>
<option value="xs">Extra Small</option>
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
</fieldset>

<input type="submit" value="Submit" />
</form>
</main>
<footer>From control by Mandip sanger</footer>
</body>
</html>
</html>
88 changes: 88 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
header {
background-color: #49bb93;
color: white;
text-align: center;
padding: 20px;
}
h1 {
margin: 0;
}
fieldset {
margin-bottom: 20px;
padding: 15px;
border: 1px solid #bbb;
border-radius: 4px;
}
legend {
font-weight: bold;
padding: 05px;
}

fieldset input[type="radio"] {
margin-right: 5px;
}

fieldset label {
display: inline;
margin-right: 15px;
font-weight: normal;
}

body {
font-family: Arial, sans-serif;
background-color: #f5f7fa;
margin: 0;
padding: 0;
color: #333;
}
main {
display: flex;
justify-content: center;
padding: 30px 15px;
}
form {
background-color: white;
padding: 25px;
width: 100%;
max-width: 500px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
div {
margin-bottom: 20px;
}
label {
display: flex;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="email"],
select {
width: 100%;
padding: 10px;
border: 1px solid #bbb;
border-radius: 4px;
font-size: 1rem;
}
input[type="submit"] {
width: 100%;
background-color: #49bb93;
color: white;
border: none;
padding: 12px;
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #49bb93;
}
footer {
text-align: center;
background-color: #49bb93;
color: white;
padding: 15px;
margin-top: 20px;
}
Loading