Hiển thị các bài đăng có nhãn css picture. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn css picture. Hiển thị tất cả bài đăng

Thứ Hai, 18 tháng 11, 2024

CSS với hình ảnh hover

 

## HTML

<div class="elementor-portfolio-item">

<a href="#">    

    <div class="hanhpic">'.$image.'</div>    

    <div class="hanhtitle item-overlay">

    <h4>'.$title.'</h4>

    </div>

</a>

</div>

## CSS

.elementor-portfolio-item{

    align-self: flex-start;

    transition-property: transform, opacity;

    transition-timing-function: ease-in-out;

    transform-style: preserve-3d;

    overflow: hidden;

    margin: 0;

    padding: 0;

    transform: translate3d(0px, 0px, 0px);

    height: 250px;

    border-radius: 10px;

}

.hanhpic {

    position: absolute;

    background-color: rgba(0, 0, 0, .1);

    top: 0;

    left: 0;

    right: 0;

    bottom: 0;

    overflow: hidden;

}

.hanhpic img{

    height: auto;

    position: absolute;

    top: calc(50% + 1px);

    left: calc(50% + 1px);

    transform: scale(1.01) translate(-50%, -50%);

    display: block;

    width: 100%;

    max-height: none;

    max-width: none;

    transition: filter .3s;

    border: none;

    border-radius: 0;

    box-shadow: none;

}

.hanhtitle {

    opacity: 0;

    position: absolute;

    top: 0;

    left: 0;

    right: 0;

    bottom: 0;

    padding: 15px;

    transition: opacity 1s;

    display: flex;

    flex-direction: column;

    justify-content: center;

    text-align: center;

    overflow: hidden;

    background-color: #005AAACC;

}

.hanhtitle h4{

    font-size: 18px;

    font-weight: 600;

    line-height: 1.4em;

    color: #fff;

}

.item-overlay:hover {

    opacity: 1;

    transition: opacity .5s;

}