Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HTML form
Replace `<your_account>` with your Github username and copy the links to Pull Request description:
- [DEMO LINK](https://<your_account>.github.io/layout_html-form/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_html-form/report/html_report/)
- [DEMO LINK](https://kbekher.github.io/layout_html-form/)
- [TEST REPORT LINK](https://kbekher.github.io/layout_html-form/report/html_report/)

> Follow [this instructions](https://mate-academy.github.io/layout_task-guideline/#how-to-solve-the-layout-tasks-on-github)
___
Expand Down Expand Up @@ -40,7 +40,7 @@ Create HTML page with form. On form submit send form data to `https://mate-acade
- Age should be at least `1` and at max `100` with a default value of `12`
- The email field should have placeholder value: `email@example.com`.
- Text fields should have `autocomplete="off"`.
- `Submit` button should have a `type="submit"`
- `Submit` button should have a `type="submit"`
- Vertical distance between inputs should be `10px`
- Vertical distance between groups should be `20px`
- Any other styles should be browser default
Expand Down
167 changes: 166 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,172 @@
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1>HTML Form</h1>
<form action="https://mate-academy-form-lesson.herokuapp.com/create-application" method="post">
<fieldset class="form-field">
<legend>Personal information</legend>

<label for="surname">Surname:</label>
<input
type="text"
name="surname"
id="surname"
autocomplete="off"
class="form-input-gap"
>

Choose a reason for hiding this comment

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

  1. i'd recommend to wrap input with label to avoid using id/for
  2. apply class to your wrapper (label) instead of input to make outer indent
Suggested change
<label for="surname">Surname:</label>
<input
type="text"
name="surname"
id="surname"
autocomplete="off"
class="form-input-gap"
>
<label>
Surname:
<input
type="text"
name="surname"
autocomplete="off"
class="form-input-gap"
>
</label>

<br>

Choose a reason for hiding this comment

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

it's better avoid using <br />. Use css


<label for="name">Name:</label>
<input
type="text"
name="name"
id="name"
autocomplete="off"
class="form-input-gap"
>
<br>

<label for="age">How old are You?</label>
<input
type="number"
name="age"
id="age"
value="12"
min="1"
max="100"
class="form-input-gap"
>
<br>

<label for="dateOfBirth">Full date of birth:</label>
<input
type="date"
name="dateOfBirth"
id="dateOfBirth"
class="form-input-gap"
>
<br>

<label for="term">I accept the term of the agreement</label>
<input
type="checkbox"
name="term"
id="term"
>
</fieldset>

<fieldset class="form-field">
<legend>Registration</legend>

<label for="email">E-mail:</label>
<input
type="email"
name="email"
id="email"
placeholder="email@example.com"
required
class="form-input-gap"
>
<br>

<label for="password">Password:</label>
<input
type="password"
name="password"
id="password"
minlength="7"
maxlength="32"
required
>
</fieldset>

<fieldset class="form-field">
<legend>An interesting fact about you!</legend>

<div class="form-input-gap">
<label>
Do you love cats?
<span>
<input

Choose a reason for hiding this comment

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

each input/select should be wrapped with a label

Suggested change
<label>
Do you love cats?
<span>
<input
<div>
Do you love cats?
<label>
<input

type="radio"
name="yes"
value="yes"
>
Yes
</span>
<span>
<input
type="radio"
name="no"
value="no"
>
No
</span>
</label>
Comment on lines +88 to +103

Choose a reason for hiding this comment

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

should be the same name attribute to avoid this
image

</div>

<label for="favColor">What is your favorite color?</label>
<input
type="color"
name="favColor"
id="favColor"
class="form-input-gap"
>
<br>

<label for="bedTime">What time do you go to bed?</label>
<input
type="time"
name="bedTime"
id="bedTime"
class="form-input-gap"
>
<br>

<div class="form-input-gap">

Choose a reason for hiding this comment

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

redundant wrapper. apply styles to your labels

Suggested change
<div class="form-input-gap">

<label for="favCarBrand">What are your favorite brand of cars?</label>
<select
name="favCarBrand"
id="favCarBrand"
multiple
>
<option value="BMW">BMW</option>
<option value="Audi">Audi</option>
<option value="Lada">Lada</option>
</select>
</div>

<label for="workRate">How do you rate our work?</label>
<input
type="range"
name="workRate"
id="workRate"
min="0"
max="50"
>
</fieldset>

<fieldset class="form-field">
<legend>Additional info:</legend>

<div class="form-input-gap">
<label for="comment">Comments:</label>
<textarea
name="comment"
id="comment"
cols="20"
rows="2"
></textarea>
</div>


<label for="recommendation">Would you recommend us?</label>
<select name="recommendation" id="recommendation">
<option value="yes" checked>yes</option>
<option value="no">no</option>
</select>
</fieldset>
<button type="submit">Submit</button>
</form>
<script type="text/javascript" src="./main.js"></script>
</body>
</html>
8 changes: 7 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
/* styles go here */
.form-field {
margin-bottom: 20px;
}

.form-input-gap {
margin-bottom: 10px;
}

Choose a reason for hiding this comment

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

You may only apply classes only to your filedset and form field (label or div)
Example:

.fieldset:not(:last-child) {
  margin-bottom: 20px
}

.field:not(:last-child) {
  margin-bottom: 10px
}