HTML div简单实用

2017-07-13  本文已影响12人  zhao1zhihui

`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
<style>
#father{
border: 0px solid red;
width: 1300px;
height: 2170px;
margin: auto;
}
/#logo{
border: 0px solid black;
width: 1300px;
height: 50px;
}
/
.top{
border: 0px solid blue;
width: 431px;
height: 50px;
float: left;
}
#top{
padding-top: 12px;
height: 38px;
}
#menu{
border: 0px solid red;
width: 1300px;
height: 50px;
background-color: black;
margin-bottom: 10px;
}
ul li{
display: inline;
color: white;
}
#clear{
clear: both;
}

        #product{
            border: 0px solid red;
            width: 1300px;
            height: 558px;
        }
        #product_top{
            border: 0px solid blue;
            width: 100%;
            height: 45px;
            padding-top: 8px;
        }
        #product_bottom{
            border: 0px solid green;
            width: 100%;
            height: 500px;
        }
        #product_bottom_left{
            border: 0px solid red;
            width: 200px;
            height: 500px;
            float: left;
        }
        #product_bottom_right{
            border: 0px solid blue;
            width: 1094px;
            height: 500px;
            float: left;
        }
        #big{
            border: 0px solid red;
            width: 544px;
            height: 248px;
            float: left;
        }
        .small{
            border: 0px solid blue;
            width: 180px;
            height: 248px;
            float: left;
            /*让里面的内容居中*/
            text-align: center;
        }
        
        #bottom{
            text-align: center;
        }
        
        a{
            text-decoration: none;
        }
    </style>
    <!--<script type="text/javascript">
        function init(){
            //书写轮图片显示的定时操作
            setInterval("changeImg()",3000);
            
            //1.设置显示广告图片的定时操作
            time = setInterval("showAd()",3000);
        }
        
        //书写函数
        var i=0
        function changeImg(){
            i++;
            //获取图片位置并设置src属性值
            document.getElementById("img1").src="../img/"+i+".jpg";
            if(i==3){
                i=0;
            }
        }
        
        //2.书写显示广告图片的函数
        function showAd(){
            //3.获取广告图片的位置
            var adEle = document.getElementById("img2");
            //4.修改广告图片元素里面的属性让其显示
            adEle.style.display = "block";
            //5.清除显示图片的定时操作
            clearInterval(time);
            //6.设置隐藏图片的定时操作
            time = setInterval("hiddenAd()",3000);
        }
        
        //7.书写隐藏广告图片的函数
        function hiddenAd(){
            //8.获取广告图片并设置其style属性的display值为none
            document.getElementById("img2").style.display= "none";
            //9.清除隐藏广告图片的定时操作
            clearInterval(time);
        }
        
    </script>-->
    <script type="text/javascript" src="1.js" ></script>
</head>
<body onload="init()">
    <div id="father">
        <!--定时弹出广告图片位置-->
        ![](../img/f001a62f-a49d-4a4d-b56f-2b6908a0002c_g.jpg)
        
        <!--1.logo部分-->
        <div id="logo">
            <div class="top">
                ![](../img/logo2.png)
            </div>
            <div class="top">
                ![](../img/header.png)
            </div>
            <div class="top" id="top">
                <a href="#">登录</a>
                <a href="#">注册</a>
                <a href="#">购物车</a>
            </div>
        </div>
        <div id="clear">
            
        </div>
        <!--2.导航栏部分-->
        <div id="menu">
            <ul>
                <a href="#"><li style="font-size: 20px;">首页</li></a>    
                <a href="#"><li>手机数码</li></a>    
                <a href="#"><li>家用电器</li></a>    
                <a href="#"><li>鞋靴箱包</li></a>    
                <a href="#"><li>孕婴保健</li></a>    
                <a href="#"><li>奢侈品</li></a>
            </ul>
        </div>
        <!--3.轮播图部分-->
        <div id="">
            ![](../img/1.jpg)
        </div>
        <!--4.最新商品-->
        <div id="product">
            <div id="product_top">
                   
                <span style="font-size: 25px;padding-top: 8px;">最新商品</span>   
                ![](../img/title2.jpg)
            </div>
            <div id="product_bottom">
                <div id="product_bottom_left">
                    ![](../img/big01.jpg)
                </div>
                <div id="product_bottom_right">
                    <div id="big">
                        <a href="#">![](../img/middle01.jpg)</a>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                </div>
            </div>
        </div>
        <!--5.广告图片-->
        <div id="">
            ![](../img/ad.jpg)
        </div>
        <!--6.热门商品-->
        <div id="product">
            <div id="product_top">
                   
                <span style="font-size: 25px;padding-top: 8px;">热门商品</span>   
                ![](../img/title2.jpg)
            </div>
            <div id="product_bottom">
                <div id="product_bottom_left">
                    ![](../img/big01.jpg)
                </div>
                <div id="product_bottom_right">
                    <div id="big">
                        <a href="#">![](../img/middle01.jpg)</a>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                    <div class="small">
                        ![](../img/small03.jpg)
                        <a href="#"><p style="color: gray;">电炖锅</p></a>
                        <p style="color: red;">¥399</p>
                    </div>
                </div>
            </div>
        </div>
        <!--7.广告图片-->
        <div id="">
            ![](../img/footer.jpg)
        </div>
        <!--8.友情链接和版权信息-->
        <div id="bottom">
            <a href="#">关于我们</a>
            <a href="#">联系我们</a>
            <a href="#">招贤纳士</a>
            <a href="#">法律声明</a>
            <a href="#">友情链接</a>
            <a href="#">支付方式</a>
            <a href="#">配送方式</a>
            <a href="#">服务声明</a>
            <a href="#">广告声明</a>
            <p>
                Copyright © 2005-2016 传智商城 版权所有 
            </p>
        </div>
    </div>
</body>

</html>`

上一篇下一篇

猜你喜欢

热点阅读