Skip to content
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

[ko] Update: How to structure a web form #14002

Merged
merged 7 commits into from
Aug 2, 2023
Merged
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
184 changes: 184 additions & 0 deletions files/ko/learn/forms/how_to_structure_a_web_form/example/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
title: Example
slug: Learn/Forms/How_to_structure_a_web_form/Example
---
hochan222 marked this conversation as resolved.
Show resolved Hide resolved

[HTML 폼 구성 방법](/ko/docs/Learn/Forms/How_to_structure_a_web_form)의 기본 결제 폼 예제 입니다.

## A payment form
hochan222 marked this conversation as resolved.
Show resolved Hide resolved

### HTML

```html-nolint
<form method="post">
<h1>Payment form</h1>
<p>
Required fields are followed by
<strong><span aria-label="required">*</span></strong>.
</p>
<section>
<h2>Contact information</h2>
<fieldset>
<legend>Title</legend>
<ul>
<li>
<label for="title_1">
<input type="radio" id="title_1" name="title" value="A" />
Ace
</label>
</li>
<li>
<label for="title_2">
<input type="radio" id="title_2" name="title" value="K" />
King
</label>
</li>
<li>
<label for="title_3">
<input type="radio" id="title_3" name="title" value="Q" />
Queen
</label>
</li>
</ul>
</fieldset>
<p>
<label for="name">
<span>Name: </span>
<strong><span aria-label="required">*</span></strong>
</label>
<input type="text" id="name" name="username" />
</p>
<p>
<label for="mail">
<span>Email: </span>
<strong><span aria-label="required">*</span></strong>
</label>
<input type="email" id="mail" name="usermail" />
</p>
<p>
<label for="pwd">
<span>Password: </span>
<strong><span aria-label="required">*</span></strong>
</label>
<input type="password" id="pwd" name="password" />
</p>
</section>
<section>
<h2>Payment information</h2>
<p>
<label for="card">
<span>Card type:</span>
</label>
<select id="card" name="usercard">
<option value="visa">Visa</option>
<option value="mc">Mastercard</option>
<option value="amex">American Express</option>
</select>
</p>
<p>
<label for="number">
<span>Card number:</span>
<strong><span aria-label="required">*</span></strong>
</label>
<input type="tel" id="number" name="cardnumber" />
</p>
<p>
<label for="expiration">
<span>Expiration date:</span>
<strong><span aria-label="required">*</span></strong>
</label>
<input
type="text"
id="expiration"
required="true"
placeholder="MM/YY"
pattern="^(0[1-9]|1[0-2])\/([0-9]{2})$" />
</p>
</section>
<section>
<p><button type="submit">Validate the payment</button></p>
</section>
</form>
```

### CSS

```css
h1 {
margin-top: 0;
}

ul {
margin: 0;
padding: 0;
list-style: none;
}

form {
margin: 0 auto;
width: 400px;
padding: 1em;
border: 1px solid #ccc;
border-radius: 1em;
}

div + div {
margin-top: 1em;
}

label span {
display: inline-block;
width: 120px;
text-align: right;
}

input,
textarea {
font: 1em sans-serif;
width: 250px;
box-sizing: border-box;
border: 1px solid #999;
}

input[type="checkbox"],
input[type="radio"] {
width: auto;
border: none;
}

input:focus,
textarea:focus {
border-color: #000;
}

textarea {
vertical-align: top;
height: 5em;
resize: vertical;
}

fieldset {
width: 250px;
box-sizing: border-box;
margin-left: 136px;
border: 1px solid #999;
}

button {
margin: 20px 0 0 124px;
}

label {
position: relative;
}

label em {
position: absolute;
right: 5px;
top: 20px;
}
```

### Result
hochan222 marked this conversation as resolved.
Show resolved Hide resolved

{{ EmbedLiveSample('A_payment_form', '100%', 620) }}
Loading