Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
47 changes: 46 additions & 1 deletion Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,58 @@
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<div>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required minlength="2">
</div>
<div>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
</div>
<div>
<label for="color"></label>Choose a color:</label>
<select name="color" id="color">
<option value="white">White</option>
<option value="black">Black</option>
<option value="blue">Burgundy</option>
</select>
</div>
<div>
<p>Choose a size:</p>
<label>
<INPUT type="radio" id="xs" name="size" value="XS" required>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why is the INPUT capitalized?

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.

Good catch, I didn’t notice that. I’ll change it to lowercase for consistency and better formatting. Thank you for pointing it out.

XS
</label>
<LABel>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The casing looks strange to me. How can you ensure consistent formatting in your code automatically?

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.

Thank you for the feedback. I think using a formatter like Prettier in VS Code would help keep my HTML formatting and casing consistent automatically. I’ll start using that moving forward. I also wanted to practice writing and formatting the code manually first so I could become more familiar with the syntax and remember it better.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes Prettier is a great tool for formatting the code automatically. You can make it a habbit to run it before committing the code (and at some point configure it to run automatically when you save a file)

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.

Thank you, that’s really helpful advice.

<INPUT type="radio" id="s" name="size" value="S">
S
</LABel>
<label>
<INPUT type="radio" id="m" name="size" value="M">
M
</label>
<label>
<INPUT type="radio" id="l" name="size" value="L">
L
</label>
<label>
<INPUT type="radio" id="xl" name="size" value="XL">
XL
</label>
<label>
<INPUT type="radio" id="xxl" name="size" value="XXL">
XXL

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A note on the input types. I would use radio buttons for the colors and a drop down for the t shirt sizes. Radio buttons require more space so often it is better to use radio buttons if there are not to many options. (Just fyi. You don't need to change it)

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.

Thank you for the feedback and explanation. That makes sense, especially about using radio buttons when there are fewer options. I’ll keep that in mind for future forms and projects.

</label>
</div>
<button type="submit">Order T-shirt</button>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
Expand All @@ -21,7 +66,7 @@ <h1>Product Pick</h1>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>BISRAT TESFAY</p>
</footer>
</body>
</html>
39 changes: 39 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
body {
font-family: Arial, sans-serif;
background-color: #dfd0d0;
margin: 0;
padding: 40px;
}
h1 {
text-align: center;
color: #180404;
margin-bottom: 30px;
}
form {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 600px;
margin: auto;
}
div {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input,
select,
button {
background-color: #f9f9f9;
color: #180404;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button :hover {
background-color: #180404;
}
Loading