<div class="layer showed">
<h2>Упражнение 1</h2>
<p>Добавьте "всплывающую подсказку" в абзац ниже с текстом "School".</p>
<div class="task-box">
<p><p <input id="task11" type="text" maxlength="5" style="width: 50px;">="School">School - школа для детей и взрослых.</p></p>
<p class="result"><p title="School">School - школа для детей и взрослых.</p></p>
<div class="true">
<h3>Правильно!</h3>
<a href="#" onclick="showLayer(1)">Дальше ></a>
</div>
</div>
<input id="check" class="btn" type="button" value="Проверить >">
</div>
// layer
.layer {
display: none;
}
.showed {
display: block;
.task-box {
position: relative;
background: #eeeeee;
margin-top: 50px;
padding: 50px 30px;
font-size: 20px;
line-height: 3;
color: #000000;
input {
border: none;
height: 25px;
font-size: 20px;
color: #333333;
text-align: center;
letter-spacing: 2px;
}
.result {
color: #0059ff;
opacity: 0;
}
.true {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 50px 30px;
background: #dff0d8;
color: #468847;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
display: none;
a {
color: #468847;
font-size: 18px;
}
}
h3 {
font-weight: 300;
}
}
.btn {
margin-top: 30px;
height: 70px;
padding: 0 25px;
font-size: 18px;
letter-spacing: 1px;
border: none;
background: #ffcc00;
cursor: pointer;
transition: opacity .5s;
&:hover {
opacity: .7;
}
}
}
View Compiled
// task 11
let userVal = document.getElementById('task11').value
let trueVal = 'title'
let check = document.getElementById('check')
check.onclick = function() {
if (userVal === trueVal) {
document.getElementsByClassName('true').style.display = 'block';
}
return false
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.