校趣淘吧 关注:3贴子:93
  • 3回复贴,共1
焦点图http://www.superslide2.com/demo.html


1楼2016-01-27 11:10回复
    div实现水平居中只需要设置固定宽度和margin:0 auto即可,
    给你2个解决方案:
    1、条件是div的高度和宽度是固定的
    <style type="text/css">
    <!--
    div1 {
    position:relative;
    width:600px;
    height:500px;
    border:1px solid #008800;
    }
    div2 {
    position:absolute;
    top:50%;
    left:50%;
    margin:-150px 0 0 -200px;
    width:400px;
    height:300px;
    border:1px solid #008800;
    }-->
    </style>
    <div class="div1">
    <div class="div2">让层垂直居中</div>
    </div>
    其实解决的思路是这样的:首们需要position:absolute;绝对定位。而层的定位点,使用外补丁margin负值的方法。负值的大小为层自身宽度高度除以二。
    如:一个层宽度是400,高度是300。使用绝对定位距离上部与左部都设置成50%。而margin-top的值为-150。margin-left的值为-200。这样我们就实现了层垂直居中于父级层的样式编写。
    2、条件是div的高度和宽度是不固定的
    如果div宽度不固定,那用div就有点困难了,虽然用js获取当前高宽再附加css可以解决,但是要用到js来解决问题就有点逊了;
    我给你一个思路,你不妨试试table布局,table不设置宽度的情况下默认是宽度和高度都是最小化的,这样给table设置margin:0 auto就可以让这个table水平方向居中;
    解决了水平居中,那就来解决垂直居中,td中的内容默认是垂直居中的,那么只要两者互相嵌套一下不就解决水平垂直居中了!
    但是有一个问题,你所需要垂直居中的父级table的高度是否固定,如果父级高度固定,那么子级高度不固定也一样可以垂直居中


    2楼2016-01-27 11:10
    回复
      2025-06-27 11:35:57
      广告
      让ecshop用户名、手机号、email登陆方法, 仅适用于没有做过任何平台整合的ECSHOP网站 修改文件: 1、includes/modules/integrates/ecshop.php $this->field_email = 'email'; 在以上代码下面增加 $this->field_phone = 'mobile_phone'; ===================================================================== 找到 function check_user($username, $password = null) 这个下面的 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_name . "='" . $post_username . "'"; 修改为 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "'"; 再找到 $sql = "SELECT user_id, password, salt,ec_salt " . " FROM " . $this->table($this->user_table). " WHERE user_name='$post_username'"; 修改为 $sql = "SELECT user_id, password, salt,ec_salt " . " FROM " . $this->table($this->user_table). " WHERE user_name='$post_username' or mobile_phone='$post_username' or email='$post_username'"; 2、includes/modules/integrates/integrate.php 找到 /* 会员邮箱的字段名 */ var $field_email = ''; 在下面增加 /* 会员手机的字段名 */ var $field_phone = ''; 找到 function login($username, $password, $remember = null) 下面的 if ($this->need_sync) { $this->sync($username,$password); } 在上面增加 $sql = "SELECT " . $this->field_name . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_phone . " = '$username' or " . $this->field_name . " = '$username' or " . $this->field_email . " = '$username'"; $username = $this->db->getOne($sql, true); 找到 function check_user($username, $password = null) 下面的 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_name . "='" . $post_username . "'"; 修改为 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "'"; 找到 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE " . $this->field_name . "='" . $post_username . "' AND " . $this->field_pass . " ='" . $this->compile_password(array('password'=>$password)) . "'"; 修改为 $sql = "SELECT " . $this->field_id . " FROM " . $this->table($this->user_table). " WHERE (" . $this->field_name . "='" . $post_username . "' or " . $this->field_phone . "='" . $post_username . "' or " . $this->field_email . "='" . $post_username . "') AND " . $this->field_pass . " ='" . $this->compile_password(array('password'=>$password)) . "'"; 再找到 function sync ($username, $password='', $md5password='') 下面的 $sql = "SELECT user_name, email, password, sex, birthday". " FROM " . $GLOBALS['ecs']->table('users'). " WHERE user_name = '$username'"; 修改为 $sql = "SELECT user_name, email, password, sex, birthday". " FROM " . $GLOBALS['ecs']->table('users'). " WHERE user_name = '$username' or mobile_phone = '$username' or email = '$username'";


      3楼2016-02-02 20:55
      回复
        如何修改Nginx服务内部默认名称为任意名称
        http://www.douban.com/note/487300159/


        4楼2016-02-23 16:18
        回复