CSS练习我的设置页面

<!DOCTYPE html>
<html>
<head>
    <title>我的设置</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/mySet.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>
    <div class="wrapper">
        <div class="header">
            <a href=""><img src="images/return.png"></a>
            我的设置
        </div>
        <div class="space"></div>
        <div class="detail">
            <form>
            <ul>
                <li>头像<span><img src="images/pic.jpg" id="headpic"/></span></li>
                <li>昵称<span>啦啦啦</span></li>
                <div class="space"></div>
                <li>生日<span>2012-02-23</span></li>
                <li>性别<span>男</span></li>
                <li>身高<span>180CM</span></li>
                <div class="space"></div>
                <li>体重<span>60KG</span></li>
                <li>运动爱好<span>篮球</span></li>
                <li onclick="show_signatureEditor();">签名<span id="sig">君不见黄河之水天上来</span></li>
            </ul>
            </form>
        </div>
        <!-- <div id="bottom">
            <button>保存修改</button>
        </div> -->
    </div>
    <!-- 编辑签名 -->
    <div class="wrapper" id="signature_wrap">
        <div class="header">
            <a href="javascript:cancel(‘signature_wrap‘);"><img src="images/return.png"></a>
            个性签名
            <!-- <input type="button" name="" class="save" value="保存"> -->
            <!-- <button class="save">保存</button> -->
        </div>
        <div class="ebox">
            <!-- <input type="text" name=""> -->
            <textarea id="signature" onpaste="ps()" placeholder="请输入个性签名"></textarea>
            <span class="sigCount">30</span>
        </div>
        <div id="bottom">
            <button onclick="save_signature();">保存修改</button>
        </div>
    </div>
</body>
<script type="text/javascript">
    function show_signatureEditor(){
        var h=$(document.body).height();
        $("#signature").val(‘‘);
        $("#signature_wrap").css({‘height‘:h+‘px‘,‘display‘:‘block‘});
    }

    function cancel(id){
        $("#"+id).css({‘display‘:‘none‘});
    }
    // document.getElementById(‘signature‘).onpaste=function(){
    //     if(this.value.length>20){
    //         this.value=this.value.substr(0,20);
    //     }
    // }
    function ps(){
        event.returnValue=false;
    }
    // 借助输入法输入中文无效
    // document.getElementById(‘signature‘).onkeydown=function(){
    //     if(this.value.length>=20){
    //         if(event.keyCode==8){

    //         }else{
    //             event.returnValue=false;
    //         }
    //     }
    // }
    var sig=document.getElementById(‘signature‘);
    // sig.addEventListener(‘keydown‘,function(e){
    //     if(this.value.length>=20){
    //         if(event.keyCode==8){

    //         }else{
    //             event.returnValue=false;
    //         }
    //     }
    // });

    function save_signature(){
        $("#sig").html(sig.value);
        $("#signature_wrap").css({‘display‘:‘none‘});
    }

    $(function(){
            /*字数限制*/
            $("#signature").on("input propertychange", function() {
                var $this = $(this),
                    _val = $this.val(),
                    count = "";
                if (_val.length > 30) {
                    $this.val(_val.substring(0, 30));
                }
                count = 30 - $this.val().length;
                $(".sigCount").html(count);
            });
    });
</script>

</html>

CSS

/* 覆盖 user agent stylesheet */
body {
    margin: 0;
}
/* 去掉ul li 前面圆点 */
/*ul {padding: 0;}*/
ul {
    /*去掉圆点*/
    list-style: none;
    /*去掉内边距*/
    padding: 0;
    margin-top: 0;
}
.wrapper {
    display: block;
    background-color: #fff;
    width:100%;
    max-width: 640px;
    width:expression_r(document.body.clientWidth > 640 ? "640px": "auto" );
    font-family:‘微软雅黑‘;
    color: #6c6c6c;
}
.header {
    background: #555;
    height: 50px;
    padding: 0 10px;
    border-bottom: #c6c6c6 solid 1px;
    text-align: center;
    line-height: 45px;
    vertical-align: middle;
    color: #fff;
}

.header a {
    float: left;
    display: inline-block;
    line-height: 50px;

}

.header a img{
    vertical-align: middle;
}
.detail li{
    padding: 0 10px;
    height: 45px;
    line-height: 45px;
    border-bottom: #c6c6c6 solid 1px;
    color: #333;
    display: list-item;
    text-align: -webkit-match-parent;
    vertical-align: middle;
}
.detail li span {
    float: right;

    line-height: 45px;
}
.detail li img#headpic {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    vertical-align: middle;
}
.space {
    width: 100%;
    height: 15px;
    background: #f5f5f5;
}
#bottom {
    margin-top: 20px;
    text-align: center;
}
#bottom button {
    display: inline-block;
    width: 50%;
    height: 50px;
    background-color: #fac240;
    border: #f5f5f5 1px solid;
    border-radius: 5px;
    color: #fff;
    outline: none;
}

#signature_wrap {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
}
#signature_wrap input[type="button"] {
    height: 30px;
    width: 8%;
    background: #fac240;
    line-height: 50px;
    display: inline-block;
    vertical-align: middle;
    border: 0px;
    border-radius: 4px;
}
.ebox {

    margin: 50px 10px 0px 10px;
    border-bottom: #fac240 solid 1px;
}
.ebox textarea {
    width: 100%;
    height: 100px;
    border:none;
    outline: none;
    margin-bottom: 0px;
    font-family: "微软雅黑"
    font-size: 26px;
    text-decoration: none;
}

.ebox span {
    float: right;
}

头部标题中如果在左边或右边添加按钮,会影响文字居中,如何使文字固定在中间,不受其他部分影响?

<span>30</span>为什么会在包裹它的div外部显示。

时间: 2024-08-13 21:59:28

CSS练习我的设置页面的相关文章

如何设置页面缓存或不用页面缓存

一.设置页面缓存 1.直接在页面上用<%@ OutputCache Duration="10" VaryByParam="None" %>声明来缓存页面 2.使用服务端方法: //将Cache-Control标头设置为HttpCacheAbility值 Response.Cache.SetCacheability(HttpCacheability.Public); //将页面的绝对过期时间 Response.Cache.SetExpires(DateTi

CSS让footer保持在页面底部

序:当希望将footer保持在页面底部(即使页面内容高度低于窗口高度),可以尝试下面的方法.. <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <title>CSS让footer保持在页面底部</title> <style type="text/css"> * { margin:

CSS3改变页面默认选中背景颜色及设置页面禁止全选或局部选择

改变默认选中的背景颜色 ::-moz-selection{background:#FF0000;color:#FFFFFF;} ::selection {background:#FF0000;color:#FFFFFF;} code::-moz-selection {background:#FF0000;color:#FFFFFF;} code::selection {background:#FF0000;color:#FFFFFF;} 设置页面禁止选中 /*全局*/ html,body{ pa

html&amp;css实现简单的注册页面

使用HTML实现注册页面 HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>注册页面</title> </head> <body> <form action="#" method="post"> <table bor

css样式表中设置table的第一列的宽度是固定值

table{table-layout:fixed;}table tr td:first-child,table tr td:first-child{width:120px;} 首行第一个td定宽同列的宽度都会和他一样. *注意 第一行 第一个用的是 td 还是 th css样式表中设置table的第一列的宽度是固定值,布布扣,bubuko.com

CSS如何将边框设置为虚线

CSS如何将边框设置为虚线: 在默认状态文本框都是实线边框,下面就来介绍一下如何实现虚线边框. 实例代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.51texiao.cn/" /> <title>蚂蚁部落</title&

7.4 设置页面间的链接

如果我们把淘宝网案例的主页.登录页面.注册页面.商品展示页.商品详细介绍页.购买页等页面都做好了,并且应用了模板和样式,其实这些页面还都是孤立的,没有任何联系,那如何将这些页面之间相互联系起来?从而形成一个有机的整体. 我想大家会异口同声地回答使用超链接,没错!就是使用超链接.超链接能把同一网站中同一页面不同部分,同一网站中不同的页面.不同网站中不同页面不同部分.不同网 站中不同页面链接起来,从而在不同网站.不同页面.同一页面不同部分之间建立起千丝万缕的联系. 请大家按下面的要求把有关页面通过超

深度分析:Android中Mms设置页面更改短信中心号码流程

相关控件初始化方法:showSmscPref private void showSmscPref() { int count = MSimTelephonyManager.getDefault().getPhoneCount(); boolean airplaneModeOn = Settings.System.getInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) != 0; for (int i = 0; i < c

css如何实现只设置type为text的input元素的样式

css如何实现只设置type为text的input元素的样式:在实际应用中,可能会遇到这样的情况,那就是有很多input元素,但是type类型各不相同.可能只需要为某种type类型指定相关的样式.当然实现此效果的方式很多,比如单独为指定类型的input设置class.下面介绍一下如何利用属性选择器实现此功能.代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <me