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

Добавляет доку про minlength и maxlength #4933

Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Поле по умолчанию с типом number — Атрибуты minlength и maxlength — Дока</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap">
<style>
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}

html {
color-scheme: dark;
font-size: 18px;
}

body {
min-height: 100vh;
padding: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #18191C;
color: #FFFFFF;
font-family: "Roboto", sans-serif;
}

div {
display: flex;
align-items: center;
}

label {
display: inline-block;
margin-right: 55px;
font-size: 1.5rem;
font-weight: 500;
line-height: 1;
}

input {
width: 300px;
border: 1px solid #FFFFFF;
border-radius: 6px;
padding: 10px 15px;
background-color: transparent;
color: #FFFFFF;
font-size: 1rem;
font-weight: 300;
font-family: inherit;
-webkit-appearance: none;
appearance: none;
}

input:focus {
border-color: #FF8630;
outline: none;
}

@media (max-width: 768px) {
body {
padding: 30px;
}

div {
display: block;
}

label {
margin-left: 0;
margin-bottom: 10px;
}

input {
width: 100%;
}
}
</style>
</head>
<body>
<div>
<label for="items">Выберите количество (максимум 999):</label>
<input
type="number"
min="1"
max="999"
maxlength="3"
id="items"
>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Работающее поле с типом number — Атрибуты minlength и maxlength — Дока</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap">
<style>
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}

html {
color-scheme: dark;
font-size: 18px;
}

body {
min-height: 100vh;
padding: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #18191C;
color: #FFFFFF;
font-family: "Roboto", sans-serif;
}

div {
display: flex;
align-items: center;
}

label {
display: inline-block;
margin-right: 55px;
font-size: 1.5rem;
font-weight: 500;
line-height: 1;
}

input {
width: 300px;
border: 1px solid #FFFFFF;
border-radius: 6px;
padding: 10px 15px;
background-color: transparent;
color: #FFFFFF;
font-size: 1rem;
font-weight: 300;
font-family: inherit;
-webkit-appearance: none;
appearance: none;
}

input:focus {
border-color: #FF8630;
outline: none;
}

@media (max-width: 768px) {
body {
padding: 30px;
}

div {
display: block;
}

label {
margin-left: 0;
margin-bottom: 10px;
}

input {
width: 100%;
}
}
</style>
</head>
<body>
<div>
<label for="items">Выберите количество (максимум 999):</label>
<input
type="number"
id="items"
pattern="\d+"
min="1"
max="999"
onKeyPress="if(this.value.length === 3 ) return false"
>
</div>
</body>
</html>
43 changes: 0 additions & 43 deletions html/minlength-maxlength/demos/input-example/index.html

This file was deleted.

105 changes: 105 additions & 0 deletions html/minlength-maxlength/demos/input-invalid-styles/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<title>Поле со стилями для invalid — Атрибуты minlength и maxlength — Дока</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap">
<style>
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}

html {
color-scheme: dark;
font-size: 18px;
}

body {
min-height: 100vh;
padding: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #18191C;
color: #FFFFFF;
font-family: "Roboto", sans-serif;
}

div {
display: flex;
align-items: center;
}

label {
display: inline-block;
margin-right: 55px;
font-size: 1.5rem;
font-weight: 500;
line-height: 1;
}

input {
width: 300px;
border: 1px solid #FFFFFF;
border-radius: 6px;
padding: 10px 15px;
background-color: transparent;
color: #FFFFFF;
font-size: 1rem;
font-weight: 300;
font-family: inherit;
-webkit-appearance: none;
appearance: none;
}

input:focus {
border-color: #FF8630;
outline: none;
}

input:invalid {
border-color: #2E9AFF;
background-color: rgb(46, 154, 255, 0.1);
outline: none;
}

@media (max-width: 768px) {
body {
padding: 30px;
}

div {
display: block;
}

label {
margin-left: 0;
margin-bottom: 10px;
}

input {
width: 100%;
}
}
</style>
</head>
<body>
<div>
<label for="password">Введите пароль (от 8 до 16 символов):</label>
<input
type="password"
id="password"
name="password"
minlength="8"
maxlength="16"
required
>
</div>
</body>
</html>
Loading
Loading