css3 實現(xiàn)鼠標(biāo)放上去圖片外框不變大,里面中心放大

<div class="img-box">
            <img src="img/index_11.png" class="img">
 </div>
css代碼
.img-box{
    width: 390px;
    height: 296px;
    overflow: hidden;  //這個一定要加上  不然就不是外框不變里面變大了
}
.img{
    display: block;
    width: 100%;
    height: 100%;
    transition: all 1s;
}
.img:hover{
    transform: scale(1.4); //放大 倍數(shù)隨意
}

使背景色透明但是文字顏色不變

在前端開發(fā)過程中,要求實現(xiàn)背景色透明度0.8,但是文字顏色要求按給定顏色設(shè)置。

如果直接設(shè)置背景opacity值為0.8,會使文字的顏色發(fā)生改變。解決方法就是在設(shè)置背景色時使用rgba(red,green,blue,opacity)來對背景色進(jìn)行設(shè)置,這樣就可以單獨的改變背景的透明度,而不會影響到里面的內(nèi)容(包括文字和圖片)。
web前端超出兩行用省略號表示

<span class="GW_bod0112211">
  吐魯番特級無炳黑加侖葡萄干500g包郵無籽吐魯番特級無炳黑加侖葡萄干500g包郵無籽吐魯番特級無炳黑加侖葡萄干500g包郵無籽,超大孕婦零食
</span>

span{
    height: 40px;
    line-height: 20px;
    width: 300px;
    display: -webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    overflow: hidden;
}

網(wǎng)站底部

<p>Copyright ? 2003-
        <script type="text/javascript">document.write(new Date().getFullYear());</script>
        深圳市xxx科技有限公司 
</p>

效果圖:


image.png

jquery圖片切換

layui/js/jquery圖片切換.html文件

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>jquery圖片切換</title>
        <style type="text/css">
            .introduce-box3{
                width: 150px;
                height: 60px;
                margin-top: 50px;
                margin-left: 225px;
                border: #00FFFF 1px solid;
            }
             .introduce-box3 .p{
                float: left;
                font-size: 21px;
            }
            .introduce-box3 .p1{
                color: red;
            }
             .introduce-box3>img{
                width: 36px;
                float: right;
            }
        </style>
    </head>
    <body>
        <div class="introduce-box3">
            <p class="p">關(guān)于Turing</p>
            <img src="image/right1.png" >
        </div>
        <script type="text/javascript" src="jquery.min.js"></script>
        <script type="text/javascript" src="layui/js/jquery圖片切換.js">
            
        </script>
    </body>
</html>

layui/js/jquery圖片切換.js文件

$(function(){
                $(".introduce-box3").hover(function(){
                    $(this).children(".p").addClass("p1");
                    $(this).children("img").attr("src","image/redright.png");
                },function(){
                    $(this).children(".p").removeClass("p1");
                    $(this).children("img").attr("src","image/right1.png");
                })
            })
image.png

image.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容