Мой Справочник | CSS3 | Маска

Front-end

Разработка веб-сайтов любой сложности, от простых одностраничников до интернет-магазинов

Узнать подробнее

HTML:

<div class="cont">
  <div class="hover-mask">
    <h3>Front-end</h3>
    <p>Разработка веб-сайтов...</p>
    <a href="#">Узнать подробнее</a>
  </div>
</div>

CSS:

/*1. Контейнер*/
.cont {
    position: relative;
    width: 200px;
    height: 200px;
    outline: 3px solid pink;
    margin: 30px auto;
    background: #fff url(../pict/FrontEnd.jpg) no-repeat;
    background-size: 200px;
    font-family: Verdana, Tahoma, sans-serif;
    color: #fff;
    text-align: center;
}
/*2. Маска*/
.hover-mask {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    background: rgba(123, 123, 123, 0.9);
}
/*3. Заголовок маски*/
.hover-mask h3 {
    width: 90%;
    background: rgb(70, 70, 70);
    border-radius: 10px;
    margin: 15px auto;
}
/*4. Описание маски*/
.hover-mask p {
    width: 90%;
    background: rgb(80, 80, 80);
    border-radius: 10px;
    margin: 0 auto;
    margin-bottom: 15px;
    font-size: 13px;
}
/*5. Ссылка маски*/
.hover-mask a {
    display: block;
    width: 90%;
    line-height: 35px;
    background-image: linear-gradient(rgb(70, 70, 70), rgb(30, 30, 30));
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
    margin: 0 auto;
    font-weight: bold;
    cursor: pointer;
}
/*6. Наведение на ссылку маски*/
.hover-mask a:hover {
    background-image:
    linear-gradient(rgb(50, 50, 50), rgb(10, 10, 10));
    box-shadow: 0px 0px 2px 5px #ccc;
    transition-duration: 200ms;
}
/*7. Отображение маски*/
.cont:hover .hover-mask {
    display: block;
}