JSFiddle - React, Tailwind, and code Playground
HTML
<a id="formLink" href="javascript:void(0)">Обратная связь</a>
<div id="box">
<div id="box-inner">
</div>
<form>
<textarea placeholder="Ваш отзыв"></textarea>
<button>Отправить</button>
</form>
</div>
CSS
* {
font-family: Arial;
}
#box {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#box-inner {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
background: blue;
opacity: 0.3;
display: none;
}
#box form {
position: absolute;
top: 0; bottom: 0; right: 0; left: 0; /* центрирование */
margin: auto; /* центрирование */
height: 10em;
width: 20em;
border: 1px solid black;
background: white;
padding: 5%;
}
textarea {
width: 90%;
height: 80%;
border: 1px solid black;
transition: 0.3s;
outline: none;
}
textarea:focus {
border: 1px solid blue;
}
button {
padding: 1% 10%;
background: white;
border: 5px solid silver;
transition: 0.5s;
font-size: 1.05em
}
button:hover {
border: 5px solid black;
}
JavaScript
document.getElementById("formLink").onclick = function()
{
document.getElementById("box").style.display = "block";
document.getElementById("box-inner").style.display = "block";
}
document.getElementById("box").onclick = function(e)
{
if(e.toElement == document.getElementById("box-inner"))
{
document.getElementById("box").style.display = "none";
document.getElementById("box-inner").style.display = "none";
}
}