-
-
Notifications
You must be signed in to change notification settings - Fork 91
sheffield_ArminNouri_Form controls _Week 2 #210
Changes from all commits
bacef79
5078f85
246457e
839a05d
f3dfb6e
a9123e9
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 |
|---|---|---|
|
|
@@ -9,20 +9,74 @@ | |
| <link rel="stylesheet" href="styles.css"> | ||
| </head> | ||
| <body> | ||
|
|
||
| <header> | ||
| <h1>Product Pick</h1> | ||
| </header> | ||
| <main> | ||
| <form> | ||
| <!-- write your html here--> | ||
| <!-- try writing out the requirements first--> | ||
| <form name="choosing" method="post" class="field-wrap"> | ||
| <div class="formbox"> | ||
| <div> | ||
| <label for="name">Name</label> | ||
| <input type="text" id="name" name="name" required> | ||
| </div> | ||
| <div> | ||
| <label for="family" >Family</label> | ||
| <input type="text" id="family" name="family" required> | ||
| </div> | ||
| <div> | ||
| <label for="email">Email</label> | ||
| <input type="email" id="email" name="email" required> | ||
| </div> | ||
| <div class="address"> | ||
| <div> | ||
| <label for="address">Address</label> | ||
| <input type="text" id="address" name="address" required> | ||
| </div> | ||
| <div class="postcode"> | ||
| <label for="postcode">Postcode</label> | ||
| <input type="text" id="postcode" name="postcode" required> | ||
| </div> | ||
|
Comment on lines
+32
to
+39
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. Do we need this information? If so, how should we validate it (e.g. Postcodes have a certain format)
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. I think for send Item we need address but for validate I can add patern on inpute for the check |
||
| <div> | ||
| <label for="t-shirtColor">Choose T-shirt Color</label> | ||
| <select name="t-shirtColor" id="t-shirtColor" required> | ||
| <option value="">-- Select a Color --</option> | ||
| <option value="Blue">Blue</option> | ||
| <option value="Black">Black</option> | ||
| <option value="Purple">Purple</option> | ||
| </select> | ||
| </div> | ||
| <div> | ||
| <label for="t-shirtSize">Choose T-shirt Size</label> | ||
| <select name="t-shirtSize" id="t-shirtSize" 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> | ||
| <label for="date">Choose Delivery Date:</label> | ||
|
|
||
| <input type="date" name="date" id="date" min="31/10/2024" max="31/11/2024" required=""> | ||
|
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. I notice that the date picker allows dates outside of your bounds here. Any ideas why? Also, what does
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 notice this i relisede I wrote wrong format it should be yyyy/mm/dd. |
||
| </div> | ||
| </div> | ||
|
|
||
|
|
||
| <button type="submit" id="choose">Submit</button> | ||
| </div> | ||
| </form> | ||
|
|
||
|
|
||
| </main> | ||
| <footer> | ||
| <!-- change to your name--> | ||
| <h2>By HOMEWORK SOLUTION</h2> | ||
| <h2>By Armin Nouri</h2> | ||
| </footer> | ||
| </body> | ||
|
|
||
| </html> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| /* Basic Reset */ | ||
| * { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| /* Body styling */ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| line-height: 1.6; | ||
| background-color: #FBFDFC; /* Light background */ | ||
| color: #333; /* Dark text for readability */ | ||
| } | ||
|
|
||
| /* Container */ | ||
| .container { | ||
| width: 80%; | ||
| margin: 0 auto; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| /* Header styling */ | ||
| header { | ||
| background: #c4c4c4; /* Darker gray for better visibility */ | ||
| color: #1a1a1a; /* Darker text for contrast */ | ||
| padding: 20px 0; | ||
| text-align: center; | ||
| } | ||
|
|
||
| /* Main content */ | ||
| main { | ||
| padding: 20px; | ||
| background: #ffffff; /* White for main content */ | ||
| margin-top: 20px; | ||
| border-radius: 5px; | ||
| } | ||
|
|
||
| form { | ||
| display: flex; | ||
| } | ||
|
|
||
| .field-wrap { | ||
| margin-bottom: 40px; | ||
| } | ||
|
|
||
| .formbox { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 20px; /* Better than justify-content for consistent spacing */ | ||
| padding: 20px; /* Adds spacing inside the container */ | ||
| border: 1px solid #ccc; /* Optional: adds a border for a defined area */ | ||
| border-radius: 5px; /* Rounded corners for a more modern look */ | ||
| background-color: #f0f0f0; /* Optional: background color for better visibility */ | ||
| width: fit-content; | ||
| } | ||
|
|
||
| input, select, button { | ||
| color: #1a1a1a; /* Darker text for better contrast */ | ||
| background-color: #ffffff; /* White background for form controls */ | ||
|
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. I notice that your form control backgrounds are not white -- what is your intention?
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. I'm not haveing really good realtions with colors but for take 100% accebility i should do it. |
||
| border: 1px solid #999999; /* Darker border for better definition */ | ||
| } | ||
|
|
||
| button { | ||
| background-color: #0056b3; /* Darker blue button */ | ||
| color: #ffffff; /* White text for contrast */ | ||
| width: 70%; | ||
| margin-left: 50px; | ||
| padding: 10px; /* Adjust padding for better size */ | ||
| height: auto; /* Use auto to ensure the button is responsive */ | ||
| border: none; /* Remove border for cleaner look */ | ||
| border-radius: 5px; /* Rounded corners for button */ | ||
| } | ||
|
|
||
| .address { | ||
| display: flex; | ||
| gap: 10px; /* Creates space between address fields */ | ||
| align-items: center; /* Align items vertically in the middle */ | ||
| flex-wrap: wrap; /* Allows wrapping on smaller screens */ | ||
| } | ||
|
|
||
| .postcode { | ||
| flex: 1; /* Flex-grow:1 allows this to take up available space */ | ||
| min-width: 100px; /* Optional: sets a minimum width to maintain layout */ | ||
| } | ||
|
|
||
| /* Label styling */ | ||
| label { | ||
| transform: translateY(6px); | ||
| transition: all 0.5s ease; | ||
| pointer-events: none; | ||
| font-size: 18px; | ||
| padding-left: 10px; | ||
| color: #1a1a1a; /* Darker label text for better contrast */ | ||
| } | ||
|
|
||
| input, textarea { | ||
| font-size: 22px; | ||
| display: block; | ||
| width: 100%; | ||
| padding: 5px 10px; | ||
| background: none; | ||
| border: 1px solid #888888; /* Darker border for better visibility */ | ||
| color: #1a1a1a; /* Darker text color for better readability */ | ||
| transition: border-color 0.25s ease, box-shadow 0.25s ease; | ||
| } | ||
|
|
||
| form { | ||
| padding: 40px; | ||
| max-width: 600px; | ||
| margin: 40px auto; | ||
| border: 4px solid #f9e3c2; /* Light border */ | ||
| box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Slight shadow for depth */ | ||
| } | ||
|
|
||
| input:focus, textarea:focus { | ||
| outline: 0; | ||
| border-color: #1ab188; /* Highlight border on focus */ | ||
| } | ||
|
|
||
| /* Footer */ | ||
| footer { | ||
| background: #c4c4c4; /* Darker gray for footer */ | ||
| color: #1a1a1a; /* Dark text for contrast */ | ||
| text-align: center; | ||
| padding: 10px 0; | ||
| margin-top: 20px; | ||
| } | ||
| button#choose { | ||
|
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. is there a way we can target the submit button of the form without using its ID?
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. yeah I think there is just one button so we can but I couldn't remeber why I did this ?:) |
||
| background-color: #0056b3; /* Darker blue for better contrast */ | ||
| color: #ffffff; /* White text for readability */ | ||
| width: 70%; | ||
| margin-left: 50px; | ||
| padding: 10px; /* Ensures a comfortable touch target */ | ||
| height: auto; /* Responsive height */ | ||
| border: none; /* Removes default border */ | ||
| border-radius: 5px; /* Rounded corners */ | ||
| font-size: 16px; /* Readable font size */ | ||
| transition: background-color 0.3s, border-color 0.3s; /* Smooth transition effects */ | ||
| } | ||
|
|
||
| /* Optional: Add hover effect */ | ||
| button#choose:hover { | ||
| background-color: #004494; /* Even darker blue on hover for better visibility */ | ||
| } | ||
|
|
||
| /* Optional: Add focus effect for accessibility */ | ||
| button#choose:focus { | ||
| outline: 2px solid #1ab188; /* Green outline for focus state */ | ||
| outline-offset: 2px; /* Space between outline and button */ | ||
| } | ||
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.
What are the validation criteria for names in the requirements?
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.
just force to write name but if we want we can write a Pattern for the name
pattern="^[A-Za-z]+(([',. -][A-Za-z ])?[A-Za-z])$"