Загрузка данных
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Работа Promises</title>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: Arial, sans-serif;
background-color: #f3f3f3;
}
.content {
width: 92%;
min-height: 88vh;
display: flex;
justify-content: center;
align-items: center;
border: 3px solid #333;
border-radius: 20px;
padding: 30px;
background-color: white;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
.explanation {
width: 100%;
max-width: 1100px;
background-color: rgb(166, 169, 169);
padding: 30px;
border-radius: 15px;
border: 2px solid #555;
}
h1 {
text-align: center;
margin-top: 0;
font-size: 40px;
}
h2 {
text-align: center;
font-size: 28px;
}
.description {
text-align: center;
font-size: 18px;
line-height: 1.6;
}
.states {
display: flex;
justify-content: center;
align-items: stretch;
gap: 25px;
margin-top: 35px;
}
.pending,
.fulfilled,
.rejected {
flex: 1;
min-height: 180px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 3px solid #333;
border-radius: 15px;
padding: 20px;
background-color: white;
}
.pending {
background-color: lightyellow;
}
.fulfilled {
background-color: lightgreen;
}
.rejected {
background-color: lightcoral;
}
.states h3 {
font-size: 25px;
margin-bottom: 10px;
}
.states p {
font-size: 18px;
}
@media (max-width: 800px) {
.states {
flex-direction: column;
}
.content {
width: 95%;
min-height: auto;
margin: 20px 0;
}
}
</style>
</head>
<body>
<div class="content">
<div class="explanation">
<h1>Promise в JS</h1>
<h2>Что такое Promise?</h2>
<p class="description">
Promise (с англ. «обещание») в JavaScript — это специальный
объект, который представляет результат асинхронной операции.
Он обещает, что операция завершится успешно или с ошибкой.
</p>
<div class="states">
<div class="pending">
<h3>Pending</h3>
<p>Ожидание</p>
</div>
<div class="fulfilled">
<h3>Fulfilled</h3>
<p>Исполнено</p>
</div>
<div class="rejected">
<h3>Rejected</h3>
<p>Отклонено</p>
</div>
</div>
</div>
</div>
</body>
</html>