div+css中设计鼠标悬停,第一行图像没法控制,老是跑到第二行,麻烦给看看 - 爱问答

(爱问答)

div+css中设计鼠标悬停,第一行图像没法控制,老是跑到第二行,麻烦给看看

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <script type="text/javascript" src="jquery-3.1.0.min.js"></script>

    <style type="text/css">

    body {

        background: #f5f5f5;

    }

 

    #img ul {

        height: 614px;

        list-style: none;

    }

 

    #img ul li {

height: 315px;

background: #fff none repeat scroll 0 0;

float: left;

margin-bottom: 14px;

margin-left: 22px;

position: relative;

transition: all 0.2s linear 0s;

width: 265px;

z-index: 1;

list-style: none;

padding-top: 20px;

padding-bottom: 20px;

    }

 

    #img ul li.active {

box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);

position: relative;

border-bottom-width: 2px;

border-bottom-style: solid;

border-bottom-color: #CC0000;

    }

 

    #img ul li a {

display: block;

text-decoration: none;

list-style: none;

position: absolute;

left: 50%;

margin-left: -110px;

color: #FF0000;

font-size: 14px;

line-height: 14px;

text-align: center;

    }

 

    #img ul li img {

        width: 220px;

        height: 220px;

        border: 0 none;

    }

#text{

color:#000000;

font-size: 16px;

font-weight: bold;

   }

   #text1{

color:#000000;

font-size: 12px;

font-weight: normal;

background-color: #F0F0F0;

line-height: 25px;

   }

    </style>

    <script type="text/javascript">

    window.onload = function() {

        iHover();

    }

 

    function iHover() {

        var oLi = document.getElementById("img").getElementsByTagName("li");

        for (var i = 0; i < oLi.length; i++) {

            oLi[i].onmouseover = function() {

                    this.setAttribute('class','active');

                    $(this).animate({

                        top:10

                    },30)

 

            }

            oLi[i].onmouseout = function(){

                    this.setAttribute('class','')

                    $(this).animate({

                        top:0

                    },30)

            }

        }

 

    }

    </script>

</head>

 

<body>

    <div id="img">

        <ul>

            <li class="item">

                <a href="#">

                    <img src="1.jpg" width="160px" height="160px" alt="">                       

<span  >

<p id="text"><strong>52度盛世风韵西凤酒</strong>

       

零售价:<strong>¥59.00 </strong>   团购价:私聊

<p id="text1">精品凤香型    52%vol/500ml/每箱6瓶

</span>

</a>  

</li>

           <li class="item">

                <a href="#">

                    <img src="1.jpg" width="160px" height="160px" alt="">                       

<span  >

<p id="text"><strong>52度盛世风韵西凤酒</strong>

       

零售价:<strong>¥59.00 </strong>   团购价:私聊

<p id="text1">精品凤香型    52%vol/500ml/每箱6瓶

</span>

</a>  

</li>

            <li class="item">

                <a href="#">

                    <img src="1.jpg" width="160px" height="160px" alt="">                       

<span  >

<p id="text"><strong>52度盛世风韵西凤酒</strong>

       

零售价:<strong>¥59.00 </strong>   团购价:私聊

<p id="text1">精品凤香型    52%vol/500ml/每箱6瓶

</span>

</a>  

</li>

<li class="item">

                <a href="#">

                    <img src="1.jpg" width="160px" height="160px" alt="">                       

<span  >

<p id="text"><strong>52度盛世风韵西凤酒</strong>

       

零售价:<strong>¥59.00 </strong>   团购价:私聊

<p id="text1">精品凤香型    52%vol/500ml/每箱6瓶

</span>

</a>  

</li>

<li class="item">

                <a href="#">

                    <img src="1.jpg" width="160px" height="160px" alt="">                       

<span  >

<p id="text"><strong>52度盛世风韵西凤酒</strong>

       

零售价:<strong>¥59.00 </strong>   团购价:私聊

<p id="text1">精品凤香型    52%vol/500ml/每箱6瓶

</span>

</a>  

</li>

 

</ul>

    </div>

</body>

 

</html>


相关标签:控制css

下一篇:请问:我的笔记本电脑进入BIOS后想把第三项USBBoot移动到第一项做启动盘咋操作?谢谢!

上一篇:为什么这个sql语句不正确??

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?