css悬浮展示隐藏内容,从下向上展示

2023-12-13 03:50:04

标题
    <div class="cont">
        <div class="box">
            <img src="./images/1.jpg" alt="">
            <p class="title">无锡2日1晚自由行(5钻)·【5.23-5.25抢购】</p>
            <div>
                <p class="txt_a">
                    席位充足
                </p>
                <p class="price">
                    <sup>¥</sup><span class="price_num">350</span>起
                </p>
            </div>
            <div class="label_img">
                特卖
            </div>
          
            <div class="img_txt">
                只卖3天,套餐卖价格等于外网一间房间的价格
                <div>标题:动态效果</div>
                <div>内容:悬浮时底部向上动态展示内容</div>
            </div>
        </div>
    </div>

?

*{
    margin: 0px;
    padding: 0px;
}

.cont{
    width: 917px;
    height: 343px;
}
.box{
    width: 220px;
    height: 158px;
    color: #666666;
    float: left;
    margin: 5px 5px 12px 2px;
    position: relative;
}
img{
    width: 220px;
    height: 110px;
}
.title{
    font-size: 11px;
    height: 27px;
    line-height: 27px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.txt_a{
    float: left;
    font-size: 11px;
    color: #c2a5b2;
}
.price{
    float:right;
    font-size: 9px;
    vertical-align: super;
}
.price_num{
    font-size: 16px;
    color: red;
    font-weight: bold;
}
.label_img{
    width: 39px;
    height: 25px;
    font-size: 11px;
    background-image: url(../images/un_sprite_tag.png);
    background-repeat: no-repeat;
    position: absolute;
    top: 0px;
    left: 12px;
    text-align: center;
    color: white;
    line-height: 25px;
}
//悬浮展示样式
.img_txt{
    width: 216px;
    height: 25px;
    font-size: 11px;
    line-height: 25px;
    background-color: rgba(0, 0, 0, 0.308);
    position: absolute;
    top: 85px;
    color: white;
    overflow: hidden;
    padding-left: 4px;
    transition: 1s;
}
.box:hover .img_txt{
    height: 110px;
    top: 0px;
}

文章来源:https://blog.csdn.net/xiaoming4965/article/details/134800094
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。