<fieldset>

最近遇到一个效果,查了一下发现是一个自己从未用过的html标签<fieldset>,举个例子

使用fieldset标签很简单::

  <fieldset>

    <legend>健康信息</legend>

    身高:<input type="text" />

    体重:<input type="text" />

  </fieldset>

 

遇见这个样式以后,我想起自己之前写过一个很相似的样式,

这里是三个input框,文字是根据定位写的,当input框为focus状态或input有value值时,文字就移动到上边框处,文字背景是一个高度只有2px的半透明白色,当input为blur状态或没有value值是,文字位于input同一行的位置;

html:

<div class="relative person-shou txt-chang">
       <div class="little-txt">
             收货人
              <span> *</span>
        </div>
        <input name="shouhuo" class="info-input" type="text" value="" datatype="*" errormsg="收货人不能为空" />
 </div>
 <div class="connection relative txt-chang">
        <div class="little-txt">
                联系电话
                <span> *</span>
        </div>
        <input name="lianxi" class="info-input info-phone" type="text" value="" datatype="m" errormsg="请填写正确的联系电话" />
 </div>
 <div class="relative txt-chang relive">
        <div class="little-txt">
                收货地址
                <span> *</span>
        </div>
        <input name="shoudi" class="info-input address-info" type="text" value="" datatype="*" errormsg="请填写详细收货地址" />
 </div>

 

css:

.relative {
                position: relative
            }
            
            .address-info {
                width: 450px;
            }
            
            .info-input {
                height: 35px;
                border-radius: 3px;
                border: 1px solid #aaaaaa;
                box-shadow: 0 0 2px 1px #cccccc inset;
                padding: 1px 15px;
                margin: 5px 0px 5px 5px;
                font-size: 16px;
                color: #000000;
                z-index: 1;
            }
            
            .pro-info {
                height: 35px;
                border-color: #AAAAAA;
                color: #666666;
            }
            
            .info-phone {
                width: 270px;
            }
            
            .address-btn {
                border-color: #AAAAAA;
            }
            
            .adre-la {
                margin: 10px 0 10px 5px;
                font-size: 14px;
                color: #333333;
            }
            
            .adre-title {
                margin-left: 5px;
                margin-bottom: 25px;
            }
            
            .adre-shi {
                width: 152px;
            }
            
            .adre-di {
                margin: 5px 0px 5px 5px;
                display: inline-block;
            }
            
            .adre-display {
                display: inline-block;
            }
            
            .little-txt {
                color: #666666;
                position: absolute;
                left: 20px;
                opacity: .9;
                padding: 0px 5px;
                font-size: 16px;
                top: 13px;
            }
            
            .little-txt:before {
                content: "";
                position: absolute;
                z-index: -1;
                width: 100%;
                height: 2px;
                top: 7px;
                left: 0;
                background: #fff;
            }
            
            .person-shou {
                width: 210px;
            }
            
            .little-txt>span {
                color: #DD5555;
            }

 

jquery:

$(".txt-chang").on("click", function() {
                if($(this).find(".info-input").blur()) {
                    $(this).find("input").focus();
                }
            })
            $(".info-input").focus(function() {
                $(this).siblings(".little-txt").stop().animate({
                    "font-size": "12px",
                    "top": "-3px"
                }, 200);
                $(this).siblings(".little-txt").addClass("little-txt:before");
            })
            $(".info-input").blur(function() {
                if($(this).val() == "") {
                    $(this).siblings(".little-txt").stop().animate({
                        "font-size": "16px",
                        "top": "13px"
                    }, 200);
                    $(this).siblings(".little-txt").removeClass("little-txt:before");
                }
            })

<div class="container" id="content"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-5 col-lg-6 hidden-xs hidden-sm"> <h1 class="txt-color-red login-header-big">VisionTool MES 生产制造系统</h1> <div class="hero"> <img class="pull-right display-image" style="width: 380px;" alt="" src="/staticResource/vendor/img/demo/loading.jpg"> </div> </div> <div class="col-xs-12 col-sm-12 col-md-5 col-lg-4"> <div class="well no-padding"> <form class="smart-form client-form" id="login-form" action="index.html"> <header>系统登录认证</header> <fieldset> <section> <label class="label username">用户名</label> <label class="input"> <i class="icon-append fa fa-user"></i> <input name="username" id="username" type="username" placeholder="用户名"> <b class="tooltip tooltip-top-right"><i class="fa fa-user txt-color-teal"></i>请输入用户名</b></label> </section> <section> <label class="label">密码</label> <label class="input"> <i class="icon-append fa fa-lock"></i> <input name="password" id="password" type="password" placeholder="密码"> <b class="tooltip tooltip-top-right"><i class="fa fa-lock txt-color-teal"></i> 请输入密码</b> </label> </section> <section> <label class="label">班次</label> <div class="dropdown bootstrap-select bs3"><select name="shiftClass" tabindex="-98" class="selectpicker" id="shiftClass"></select><button title="Nothing selected" class="btn dropdown-toggle btn-default bs-placeholder" role="combobox" aria-expanded="false" aria-haspopup="listbox" aria-owns="bs-select-1" type="button" data-toggle="dropdown" data-id="shiftClass"><div class="filter-option"><div class="filter-option-inner"><div class="filter-option-inner-inner">Nothing selected</div></div> </div><span class="bs-caret"><span class="caret"></span></span></button><div class="dropdown-menu open"><div tabindex="-1" class="inner open" id="bs-select-1" role="listbox"><ul class="dropdown-menu inner " role="presentation"></ul></div></div></div> </section> <div class="note"> <a onclick="alert('请联系信息管理部:') ">忘记密码了?</a> </div> </fieldset> <footer> <button class="btn btn-primary" id="btnlogin" type="button">登录</button> </footer> </form> </div> </div> </div> </div> 这里面是否包含CSRF令牌信息
最新发布
06-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值