-
-
Notifications
You must be signed in to change notification settings - Fork 500
London | 26-ITP-May | Bisrat Tesfay | Sprint 1 | Form controls #1271
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
| XS | ||
| </label> | ||
| <LABel> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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> | ||
| 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; | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.