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://KarolinaWiktoria.github.io/layout_html-form/)
- [TEST REPORT LINK](https://KarolinaWiktoria.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 protected]`.
- 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
176 changes: 173 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,187 @@

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
content="width=device-width, initial-scale=1.0"
>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>HTML Form</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1>HTML Form</h1>
<script type="text/javascript" src="./main.js"></script>
<form
method="POST"
action="https://mate-academy-form-lesson.herokuapp.com/create-application"
>
<fieldset class="inputs-block">
<legend>Personal information</legend>

<label class="input-row">
Surname:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This way of wrapping with label is kinda unorthodox, I'd suggest in the future do it the "regular way" without wrapping and using 'for' and 'id' attributes for the sake of readability,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For now just add an empty line between all label titles and inputs e.g.:

<label class="input-row">
  Surname:

  <input name="surname" autocomplete="off">
</label>

Do it for all your labels with inputs


<input
type="text"
name="surname"
autocomplete="off"
>
</label>

<label class="input-row">
Name:

<input
type="text"
name="name"
autocomplete="off"
>
</label>

<label class="input-row">
How old are You?

<input
type="number"
name="age"
min="1"
max="100"
value="12"
>
</label>

<label class="input-row">
Full date of birth:

<input type="date" name="birthday">
</label>

<label class="input-row">
I accept the term of the agreement

<input
type="checkbox"
name="agreement"
required
>
</label>
</fieldset>

<fieldset class="inputs-block">
<legend>Registration</legend>

<label class="input-row">
E-mail:

<input
type="email"
name="email"
placeholder="[email protected]"
>
</label>

<label class="input-row">
Password:

<input
type="password"
name="password"
>
</label>
</fieldset>

<fieldset class="inputs-block">
<legend>An interesting fact about you!</legend>

<div class="input-row">
Do you love cats?

<label>

<input
type="radio"
name="cats"
value="yes"
>

Yes
</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.

Fix the indent:

<label>
  <input
    type="radio"
    name="cats"
    value="no"
  > 

  No
</label>


<input
type="radio"
name="cats"
value="no"
>

No
</label>
</div>

<label class="input-row">
What is your favorite color?

<input type="color" name="color">
</label>

<label class="input-row">
What time do you go to bed?

<input
type="time"
name="time"
step="1"
>
</label>

<label class="input-row">
What are your favorite brand of cars?

<select multiple name="cars">
<option value="bmw">BMW</option>
<option value="audi">Audi</option>
<option value="lada">Lada</option>
</select>
</label>

<label class="input-row">
How do you rate our work?

<input
type="range"
name="rate"
minlength="0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Input type range should have min and max attributes rather than minlength and maxlength, these are more appropriate for inputs with text, for example you want you password to be of some minimal length.

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.

Okay :). Thank you. I hope now everything is correct :-)

maxlength="5"
step="1"
value="0"
>
</label>
</fieldset>

<fieldset class="inputs-block">
<legend>Additional info:</legend>

<label class="input-row">
Comments:

<textarea name="comments"></textarea>
</label>

<label class="input-row">
Would you recommend us?

<select name="recommend">
<option value="yes">yes</option>
<option value="no">no</option>
</select>
</label>
</fieldset>

<button type="submit">
Submit
</button>
</form>
</body>
</html>
9 changes: 8 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
/* styles go here */
.input-row:not(:last-child) {
display: block;
margin-bottom: 10px;
}

.inputs-block:not(:last-child) {
margin-bottom: 20px;
}