WordPress增加css鼠标点击显示全文功能

如图所示

WordPress增加css鼠标点击显示全文功能-大江博客

HTML代码
<input type="checkbox" id="contTab" checked="checked" class="tabbed">
<div id="cont"><?php the_content(); ?></div>
<div class="content-more"><div class="gradient"></div> <label for="contTab" class="readmore">点击显示全文</label></div>

 

 

CSS样式表
/*阅读全文*/
#contTab{
    display: none;
}
.content-more{
    display: none;
}

#contTab:checked ~ #cont{
    max-height: 600px;
    overflow: hidden;
}
#contTab:checked ~  .content-more{
    display: block;
    position: relative;
    padding-top: 20px;
    padding-bottom: 30px;
    text-align: center;
}
#contTab:checked ~  .content-more .gradient{
    background-image: -webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0)),to(#fff));
    background-image: -webkit-linear-gradient(top,rgba(255,255,255,0),#fff);
    background-image: linear-gradient(-180deg,rgba(255,255,255,0),#fff);
    height: 80px;
    position: absolute;
    left: 0;
    top: -79px;
    width: 100%;
}
#contTab:checked ~  .content-more .readmore{
    display: inline-block;
    background: #014c84;
    color: #fff;
    width: 175px;
    height: 42px;
    border-radius: 42px;
    line-height: 42px;
    font-size: 16px;
    cursor: pointer;
}

 

未经作者允许不得转载:大江博客 » WordPress增加css鼠标点击显示全文功能
博主微信:欢迎加微一起交流
欢迎加微一起交流,每天分享更多有趣的事儿,有趣有料!
2000人已加
分享到:
赞(0)

说点啥吧抢沙发

评论前必须 ☞☞ 登录/注册 !