</br>
<!-- Ссылки на вызов модальных окон-->
<a href="#win1" class="button button-blue">Открыть окно 1</a>
<a href="#win2" >Открыть окно 2</a>
<a href="#win3" >Видео в окне 3</a>
<a href="#win4">Фото в окне 4</a>
<!-- Вызов окна через миниатюру изображения -->
</br></br></br>
<a href="#win5"><img title="" src="https://picsum.photos/150/150/?random" width="150" height="150" alt="" /></a>
<!-- Модальное окно №1 -->
<a href="#x" class="overlay" id="win1"></a>
<div class="popup">
<img title="" src="https://picsum.photos/150/150/?random" width="150" height="150" alt="" /> Здесь вы можете разместить любое содержание, текст с картинками или видео!
<a class="close"title="Закрыть" href="#close"></a>
</div>
<!-- Модальное окно №2 -->
<a href="#x" class="overlay" id="win2"></a>
<div class="popup">
Здесь вы можете разместить любое содержание, текст с картинками или видео!
<img title="" src="https://picsum.photos/400/300/?random" width="400" height="300" alt="" />
<a class="close" title="Закрыть" href="#close"></a>
</div>
<!-- Модальное окно №3 -->
<a href="#x" class="overlay" id="win3"></a>
<div class="popup">
<h2>Заголовок</h2>
Здесь вставляете видео своё или с любого стороннего ресурса, YouTube, Vimeo и т.д.(iframe, embed)...
<iframe width="560" height="315" src="https://www.youtube.com/embed/GiiaZH3fh0s" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<a class="close" title="Закрыть" href="page.html" onclick="return false"></a><!-- Выключение видео при закрытии окна -->
</div>
<!-- Модальное окно №4 -->
<a href="#x" class="overlay" id="win4"></a>
<div class="popup">
<img title="" src="https://picsum.photos/200/300/?random" width="600" height="600" alt="" />
<a class="close" title="Закрыть" href="#close"></a>
</div>
<!-- Модальное окно №5 -->
<a href="#x" class="overlay" id="win5"></a>
<div class="popup">
<img title="" src="https://picsum.photos/150/150/?random" width="550" height="550" alt="" />
<a class="close" title="Закрыть" href="#close"></a>
</div>
/* Базовые стили слоя затемнения и модального окна */
.overlay {
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
visibility: hidden;
/* фон затемнения */
background-color: rgba(0, 0, 0, 0.7);
opacity: 0;
position: fixed; /* фиксированное поцизионирование */
cursor: default; /* тип курсара */
transition: opacity .5s;
transition: opacity .5s;
transition: opacity .5s;
transition: opacity .5s;
transition: opacity .5s;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.is-image {
top: 0;
right: 0;
bottom: 0;
left: 0;
display:block;
margin: 10&;
width: 100%;
height: auto;
/* скругление углов встроенных картинок */
border-radius: 4px;
border-radius: 4px;
border-radius: 4px;
border-radius: 4px;
}
/* встроенные элементы м-медиа, фреймы */
embed, iframe {
top: 0;
right: 0;
bottom: 0;
left: 0;
display:block;
margin: auto;
min-width: 320px;
max-width: 600px;
width: 100%;
}
.popup h1 { /* заголовок 1 */
color: #008000;
text-align: left;
text-shadow: 0 1px 3px rgba(0,0,0,.3);
font:24px 'Trebuchet MS', Helvetica, sans-serif;
font-weight: bold;
}
.popup h2 { /* заголовок 2 */
color: #008000;
text-align: left;
text-shadow: 0 1px 3px rgba(0,0,0,.3);
font:22px 'Trebuchet MS', Helvetica, sans-serif;
}
/*** Формируем стили модального окна ***/
.popup {
top: 0;
right: 0;
left: 0;
font-size: 14px;
z-index: 10;
display: block;
visibility: hidden;
margin: 0 auto;
width: 90%;
min-width: 320px;
max-width: 600px;
/* фиксированное позиционирование, окно стабильно при прокрутке */
position: fixed;
padding: 15px;
border: 1px solid #383838;
/* скругление углов */
border-radius: 4px;
border-radius: 4px;
border-radius: 4px;
border-radius: 4px;
background-color: #FFFFFF;
/* внешняя тень блока */
box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.8);
/* полная прозрачность окна, появление при клике */
opacity: 0;
/* эффект перехода (появление) */
transition: all ease .5s;
transition: all ease .5s;
transition: all ease .5s;
transition: all ease .5s;
transition: all ease .5s;
}
/* активируем появление окна и затемнение фона */
.overlay:target+.popup {
top: 20%; /* положение окна от верха страницы при появлении */
visibility: visible;
opacity: 1; /* убираем прозрачность */
}
/* формируем кнопку закрытия */
.close {
position: absolute;
top: -10px;
right: -10px;padding: 0;
width: 20px;
height: 20px;
border: 2px solid #ccc;
border-radius: 15px;
border-radius: 15px;
border-radius: 15px;
border-radius: 15px;
border-radius: 15px;
background-color: rgba(61, 61, 61, 0.8);
box-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
box-shadow: 0px 0px 10px #000;
text-align: center;
text-decoration: none;
font-weight: bold;
line-height: 20px;
/* задаём значения и эффект перехода при наведении */
transition: all ease .8s;
transition: all ease .8s;
transition: all ease .8s;
transition: all ease .8s;
transition: all ease .8s;
}
.close:before {
color: rgba(255, 255, 255, 0.9);
content: "X";
text-shadow: 0 -1px rgba(0, 0, 0, 0.9);
font-size: 12px;
}
.close:hover {
background-color: rgba(252, 20, 0, 0.8);
/* крутим кнопку при наведении */
transform: rotate(360deg);
transform: rotate(360deg);
transform: rotate(360deg);
transform: rotate(360deg);
transform: rotate(360deg);
}
/* опционально при добавлении вложений */
.popup p, .popup div {
margin-bottom: 10px;
}
/* button */
.button {
font-size: 20px;
color: white;
width: 270px;
text-decoration: none;
padding: 10px 5px;
border-radius: 10px;
border-radius: 10px;
border-radius: 10px;
font-family: Helvetica, Arial, sans-serif;
transition: all 0.3s;
transition: all 0.3s;
transition: all 0.3s;
cursor: pointer;
}
.button-blue {
background-color: #0600FF;
}
.button:hover {
background-color: #5555ff;
box-shadow:0 0 10px 10px #b7b7ff inset;
}
.button:active {
background-color: #0000ff;
box-shadow:0 0 0 0 #ffffff;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.