zoukankan      html  css  js  c++  java
  • 客户端 未登录页面 (clearfix 分割线)

    做了一个手机客户端页面,未登录的状态页面

    类似 如上图所示 这样

    上面列表采取80%宽度,右侧浮动。ul li设置绝对定位。左边icon图标采取决定定位。

    为了防止小屏幕手机左边空白缝隙过小,事先给外面层设置一个padding-left;留出空白间隙

    因为上面ul列表使用了浮动,所以下面的button按钮(内联元素)会和上面在一行。这个时候对button设置display:block;clear:both;清除浮动,button即可下来显示。

    或者在ul外面嵌套一层div.给这个嵌套的div设置clearfix。

    ==================

    .clearfix:after {
    content: ".";
    display: block;
    height: 0;
    visibility: hidden;
    clear: both;
    }

    .clearfix {
    *zoom: 1;
    }

    开始我想的是,clearfix应该添加在本身元素ul上,其实不是。又尝试把clearfix样式添加在 ul和button的父元素外面。又不对。这是没有弄清楚clearfix这个属性

    .clearfix:after {       <----在类名为“clearfix”的元素内最后面加入内容;
        content: ".";     <----内容为“.”就是一个英文的句号而已。也可以不写。
        display: block;   <----加入的这个元素转换为块级元素。
        clear: both;     <----清除左右两边浮动。
        visibility: hidden;      <----可见度设为隐藏。注意它和display:none;是有区别的。仍然占据空间,只是看不到而已;
        height: 0;     <----高度为0;
        font-size:0;    <----字体大小为0;
    }

    整段代码就相当于在浮动元素后面跟了个宽高为0的空div,然后设定它clear:both来达到清除浮动的效果。(这个css的原理是经过使用 after伪对象,它将在应用clearfix的元素结尾添加content中的内容,也就是一个".",并且把他设置为块级元素 (display="block");高度设置为0,clear="both",然后将其内容隐藏掉(visibility="hidden").这样就会撑开此块级元素.)

    之所以用它,是因为,你不必在html文件中写入大量无意义的空标签,又能清除浮动。
    .clearfix { *zoom:1;}   <----这是针对于IE6的,因为IE6不支持:after伪类,这个神奇的zoom:1让IE6的元素可以清除浮动来包裹内部元素。具体意思的话,不用深究,听说微软的工程师自己都无法解释清楚。height:1%效果也是一样。、

    参考:http://blog.sina.com.cn/s/blog_60b35e830101c1r8.html

    ==========================

    还有一个难点就是  中间文字左右横线的,分割线,展示

    <div class="dividing-line">或</div>

    .dividing-line {
    80%;
    margin: 0 auto;
    text-align: center;
    height: 30px;
    line-height: 30px;
    position: relative;
    }

    .dividing-line:before {
    content: "";
    46%;
    height: 1px;
    background-color: #DEDEDE;
    display: block;
    right: 8px;
    bottom: 13px;
    position: absolute;
    }

    .dividing-line:after {
    content: "";
    46%;
    height: 1px;
    background-color: #DEDEDE;
    display: block;
    left: 8px;
    bottom: 13px;
    position: absolute;
    }

    参考:http://www.daqianduan.com/4258.html

    =============HTML==================

    <!doctype html>
    <html>

    <head>
    <title>未登录 </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=100%, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
    <meta content="telephone=no" name="format-detection" />
    <meta name="apple-mobile-web-app-title" content="贷款助手">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">
    <link href="css/base.css" type="text/css" rel="stylesheet" />
    <link href="css/unknown.css" type="text/css" rel="stylesheet" />
    </head>

    <body>
    <section class="box-sizing">
    <ul class="unknown-form">
    <li class="tab unknown-ziliao"><a href="javascript:void(0);">我的资料<span class="arrow">&gt;</span></a></li>
    <li class="tab unknown-mingpian"><a href="javascript:void(0);">生成名片<span class="arrow">&gt;</span></a></li>
    <li class="tab unknown-wenti"><a href="javascript:void(0);">常见问题<span class="arrow">&gt;</span></a></li>
    <li class="tab unknown-jieshao"><a href="javascript:void(0);">公司介绍<span class="arrow">&gt;</span></a></li>
    </ul>
    <button class="clear button login">登录</button>
    <div class="dividing-line">或</div>
    <button class="clear button register">登录</button>
    </section>

    </body>

    </html>

    ===========CSS===============

    html,
    body {
    max- 640px;
    background: #FFFFFF;
    margin: 0 auto;
    font-size: 62.5%;
    }

    .box-sizing {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -o-box-sizing: border-box;
    padding-left:2rem;
    }

    .clearfix:after {
    content: ".";
    display: block;
    height: 0;
    visibility: hidden;
    clear: both;
    }

    .clearfix {
    *zoom: 1;
    }

    .unknown-form {
    86%;
    float: right;
    margin-bottom: 3.5rem;
    }

    .unknown-form li {
    height: 7;
    line-height: 7rem;
    border-bottom: 1px #E9E9E9 solid;
    position: relative;
    }

    .unknown-form li a {
    color: #000000;
    font-size: 1.6rem;
    display: block;
    }

    .unknown-form li .arrow {
    float: right;
    margin-right: 1rem;
    color: #dedede;
    }

    .unknown-form .tab:before {
    content: '';
    display: block;
    45px;
    height: 45px;
    position: absolute;
    left: -6rem;
    top: 1.4rem;
    }

    .unknown-form .unknown-ziliao:before {
    background: url(../images/unknown-ziliao.png) no-repeat;
    background-size: 45px 45px;
    }

    .unknown-form .unknown-mingpian:before {
    background: url(../images/unknown-mingpian.png) no-repeat;
    background-size: 45px 45px;
    }

    .unknown-form .unknown-wenti:before {
    background: url(../images/unknown-wenti.png) no-repeat;
    background-size: 45px 45px;
    }

    .unknown-form .unknown-jieshao:before {
    background: url(../images/unknown-jieshao.png) no-repeat;
    background-size: 45px 45px;
    }

    .clear {
    clear: both;
    display: block;
    }

    .button {
    80%;
    height: 3.5rem;
    line-height: 3.5rem;
    border: none;
    color: #FFFFFF;
    border-radius: 2px;
    font-size: 2.1rem;
    margin: 0 auto;
    cursor: pointer;
    }

    .login {
    background: #318AE4;
    }

    .register {
    background: #5BB049;
    }

    .dividing-line {
    80%;
    margin: 0 auto;
    text-align: center;
    height: 30px;
    line-height: 30px;
    position: relative;
    font-size:1.4rem;
    }

    .dividing-line:before {
    content: "";
    46%;
    height: 1px;
    background-color: #DEDEDE;
    display: block;
    right: 0px;
    bottom: 15px;
    position: absolute;
    }

    .dividing-line:after {
    content: "";
    46%;
    height: 1px;
    background-color: #DEDEDE;
    display: block;
    left: 0px;
    bottom: 15px;
    position: absolute;
    }

    ========================

    链接:http://files.cnblogs.com/files/leshao/unknown-02%E7%89%88%E6%9C%AC.rar

  • 相关阅读:
    Nginx反向代理到Tomcat服务器
    Linux下安装php环境并且配置Nginx支持php-fpm模块
    HBase独立集群部署
    汉语-词语:伤心
    汉语-词语:无奈
    汉语-词语:无助
    汉语-词语:茫然
    汉语-词语:困惑
    汉语-词语:迷茫
    汉语-词语:迷惑
  • 原文地址:https://www.cnblogs.com/leshao/p/5067060.html
Copyright © 2011-2022 走看看