一个Web布局实例

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="js/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
        $(function(){
            //让所有链接加上默认样式
            $("#nav ul li a").addClass("linkstyle");
            $("#nav ul li ul").css("display","none");
            $("#nav ul li").each(function() { //为每一个#menu中每一个li元素绑定click事件
                $(this).bind(
                    "mouseover",
                    function()
                    {
                        $("#menu li a").addClass("curstyle");// 事件的方法为:(1)将当前li中的a加上curstyle样式,
                        $(this).siblings("li").find("a").removeClass("curstyle");//(2)将当前li的其他所有兄弟li中的a去掉curtyle样式。
                        $(this).hover(function(){
                            $(this).find("ul:eq(0)").fadeIn(100)
                        },
                        function(){
                            $(this).find("ul:eq(0)").fadeOut(100)
                        });
                    });
              });
            })
        </script>
        <style type="text/css">
            /*以下为设置li自动横向排列的样式*/
            #nav
            {
                margin: 0 auto;
                width: 80%;
                background-color: black;
                color: white;
            }
            ul,li /*这是关键,去掉ul li默认的margin padding 值*/
            {
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            #nav ul /*这是关键*/
            {
                display: flex;
                flex-direction: row;
                flex-wrap: wrap;

            }
            #nav ul li
            {
                max-width: 100px; /*每个元素的最大宽度*/
                text-align: center;
                margin-top: 10px;
                margin-bottom: 10px;
                flex:auto;  /*这是关键*/            
            }

            /*以下设置子菜单*/
            #nav ul li ul
            {
                position:absolute;
                background-color: #444444;
                top: 50px;
                opacity: 0.9;
            }
            #nav ul li ul,#nav ul li ul li
            {

                margin: 0px;
                padding: 0px;
                max-width: 100px;
            }
            #nav ul li ul li
            {
                height: 40px;
                line-height: 40px;
            }
            #nav ul li ul li:hover
            {
                background-color: #000000;
            }

            /*以下为设置多栏div自动横向排列的样式*/
            .boxes /*这是关键*/
            {
                display: flex;
                flex-direction: row;
                flex-wrap: wrap;
                width: 80%;
                margin: 0 auto;
            } 
            .box 
            {
                border: 1px solid #999; 
                border-radius: 10px; 
                flex: auto;/*这是关键*/
                margin: 5px; 
                padding: 10px; 
                width: 100px;/*每个元素的初始化宽度,这是关键*/
            }   

            .linkstyle
            {
                color:white;
                font-size:18px;
                text-decoration:none;
            }
            .linkstyle:hover
            {
                color:#00CED1;
                text-decoration:none;

            }
            .curstyle
            {
                color:#FF0000;
                font-size:18px;
                text-decoration:underline;
            }   


        </style>
    </head>
    <body>
        <div id="nav">
            <ul>
                <li><a href="#">AAAA</a></li>
                <li><a href="#">BBBB
                    <ul>
                        <li><a href="#">子子孙孙</a></li>
                        <li><a href="#">bbbbbb</a></li>
                        <li><a href="#">bbbbbb</a></li>
                    </ul>
                </li>
                <li><a href="#">CCCC</a></li>
                <li><a href="#">DDDD</a></li>
                <li><a href="#">EEEE</a></li>
                <li><a href="#">FFFF</a></li>
            </ul>
        </div>
        <div class="boxes">
            <div class="box box1">
                <h2>Don't excessively interpret South China Sea drill</h2>
                <p>"Holding sea drills is a common practice for navies with various countries. The annual, regular drill by the Chinese navy aims to test the troops' real combat abilities, boost their maneuverability, search and rescue power and the abilities to fulfil diversified military missions," said spokesperson Liang Yang on Saturday.  </p> 
            </div>
            <div class="box box2"> 
                <h2>Putin, Blatter voice mutual support at World Cup</h2> 
                <p>FIFA's President Sepp Blatter shakes hands with Russia's President Vladimir Putin (R) during the preliminary draw for the 2018 FIFA World Cup at Konstantin Palace in St. Petersburg, Russia July 25, 2015.</p>
            </div>
            <div class="box box3">
                <h2>Passenger detained for creating chaos on flight</h2>
                <p>A passenger attempted to damage facilities on Shenzhen Airlines flight ZH 9648, which departed from Taizhou City of east China's Zhejiang Province, when it was landing in Guangzhou Baiyun International Airport at around 1 a.m. on Sunday, according to the airport. </p> 
            </div>
        </div>
    </body>
</html>

这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
概述 定义和用法 frameset 元素可定义一个框架集。它被用来组织多个窗口(框架)。每个框架存有独立的文档。在其最简单的应用中,frameset 元素仅仅会规定在框架集中存在多少列或多少行。您必须使用 cols 或 rows 属性。[1] 类别 HTML之中的元素之一。 作用 其作用是指定一个框架集,用于组织多个框架和嵌套框架集。 FRAMESET 元素是 FRAME 元素的容器。HTML 文档可包含 FRAMESET 元素或 BODY 元素之一,而不能同时包含两者。 如果用户在框架中打开了 Web 文件夹后单击了 Web 文件夹中的内容,那么被单击的文件或文件夹将取代整个窗口。例如,假设页面包含两个框架,一个框架指向 http://www.microsoft.com 第二个框架指向网络驱动器。如果用户单击第二个框架中的文件或文件夹,该框架将活动整个窗口的控制,包括第一个框架。对于浏览器不能处理的文件类型,如 *.txt 文件,将会打开对应的应用程序窗口。 尽管 Web 文件夹是文件系统层次的一部分,但是该技术并不总是表示文件系统中的实际内容。一个典型的例子就是网络邻居。 使用范围 此元素在 Microsoft® Internet Explorer 3.0 的 HTML 中可用,在 Internet Explorer 4.0 的脚本中可用。 注意:不能与 <frameset></frameset> 标签一起使用 <body></body> 标签。不过,如果需要为不支持框架的浏览器添加一个 <noframes> 标签,请务必将此标签放置在 <body></body> 标签中! 编辑本段示例 下面的例子使用了 FRAMESET 元素来定义页面中的三列矩形。 <FRAMESET COLS="25%, 50%, *"> <FRAME SRC="contents.htm"> <FRAME SRC="info.htm"> <FRAME SCROLLING="NO" SRC="graphic.htm"> </FRAMESET> COLS="25%,* " 垂直切割画面(如分左右两个画面),接受整数值、百分数, * 则代表占用馀下空 间。数值的个数代表分成的视窗数目且以逗号分隔。例如 COLS="30,* ,50%" 可以切成三个视窗,第一个视窗是 30 pixels 的宽度,为一绝对分割,第二个视窗是当分配完第一及第三个视窗后剩下的空间,第三个视窗则占整个画面的 50% 宽度为一相对分割。您可自己调整数字。 ROWS="120,* " 就是横向切割,将画面上下分开,数值设定同上。唯 COLS 与 ROWS 两参数尽量不要同在一个 <FRAMESET> 标记中,因 Netacape 偶然不能显示这类形的框架,尽量采用多重分割。 <FRAME> 参数设定: 例子:<frame name="top" src="info.html" marginwidth="5" marginheight="5" scrolling="Auto" frameborder="0" noresize framespacing="6" bordercolor="#0000FF"> name="top" 设定这个框窗的名称,这样才能指定框架来作连结,必须但任意命名。 src="info.html" 设定此框窗中要显示的网页档案名称,每个框窗一定要对应着一个网页档案。你可使用绝对路径或相对路径,有关此两者详见於【连结进阶】。 marginwidth=5 表示框架宽度部份边缘所保留的空间。 marginheight=5 表示框架高度部份边缘所保留的空间。 scrolling="Auto" 设定是否要显示卷轴,YES 表示要显示卷轴,NO 表示无论如何都不要显示, AUTO是视情况显示。 frameborder=0 设定框架的边框,其值只有 0 和 1 , 0 表示不要边框, 1 表示要显示边框。(避 免使用 yes 或 no ) framespacing="6" 表示框架与框架间的保留空白的距离。 bordercolor="#008000" 设定框架的边框颜色。颜色值请参考【HTML 剖析】。 另外: border="0" 设定框架的边框厚度,以 pixels 为单位。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值