移动页面刷新的HTML按钮? [英] HTML button moving on page refresh?

查看:874
本文介绍了移动页面刷新的HTML按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我注意到这个错误有一天,当页面刷新时,登录按钮将移动到不同的位置。但是,如果从链接加载页面,则它保持在正确的位置。我正在画一个空白,为什么这样做,这是链接和代码到我的网站。



网站: http://www.clanrippgaming.net/



HTML

 < div class =login_box> 
< li>
<?php
define('IN_PHPBB',true);
$ phpbb_root_path =(defined('PHPBB_ROOT_PATH'))? PHPBB_ROOT_PATH:'./forums/';
$ phpEx = substr(strrchr(__ FILE__,'。',1);
包括($ phpbb_root_path。'common。'。$ phpEx);
$ user-> session_begin();
$ auth-> acl($ user-> data);
if(!$ user-> data [is_registered]){
?>
< div class =logged_out>
< form action =./ forums / ucp.php?mode = loginmethod =postenctype =multipart / form-data>
< input type =textplaceholder =usernamestyle =height:20px; maxlength =20size =17pxname =username/>
< input type =passwordplaceholder =passwordstyle =height:20px; maxlength =50size =16pxname =password/>
< div class =button>
< / div>
< div class =logged_out_txt>
< br>
< input type =checkboxname =autologinid =autologin/>
< font size =2color =#BDBDBD>
记住我
< div class =忘记>
< font size =2>
< a href =forums / ucp.php?mode = sendpassword>忘记密码?< / a>
< / font>
< / div>
< div class =New>
< br>
< a href =forums / ucp.php?mode = register>新会员?立即注册!< / a>
< / div>
< / div>
< input type =hiddenname =redirectvalue =./../ index.php/>
< / form>
< / div>
<?php
}
else {
echo< div class ='logged_in'>;
echo< div class ='welcome'> 。 $用户>数据[用户名];
< / div>;
echo< br>< div class ='account'>< a href = \logout.php \>注销< / a>< / div>
echo< div class ='account'>< a href = \forums / ucp.php?i = pm& folder = inbox \> Messages< / a>< DIV>中;
echo< div class ='account'>< a href = \forums / ucp.php \>我的帐户< / a>< / div>
回显< / div>;
}
?>
< / li>
< / div>

CSS

  .login_box {
float:right;
width:330px;
height:75px;
margin-top:7px;
margin-right:-5px;
list-style:none;
}
.login_box li {
}
.login_box li a {
color:#BDBDBD;
text-decoration:none;
padding-left:60px;
padding:0px;
}
.logged_in {
background-image:url(images / bg_login2.png);
border:3px solid#000000;
大纲:1px solid#BDBDBD;
width:304px;
height:55px;
margin-left:-2px;
padding-top:5px;
}
.logged_out {
margin-right:38px;
}
.logged_out_txt {
margin-top:-20px;


解决方案

更新以下更改CSS类,它将是正常的。



CSS

  .logged_out {
margin-right:22px;
position:relative;
}

.button {
position:absolute;
top:0;
right:0;

$ / code>

删除 display:inline;浮动:权利; margin-top:0;和margin-left:4px from .button


So I noticed this bug the other day where the button for the log in will move to a different location when the page is refreshed. However, if page is loaded from link, then it stays in correct position. I am drawing a blank as to why this would do this, here is the link and the code to my site.

Website: http://www.clanrippgaming.net/

HTML:

<div class="login_box">
    <li>
        <?php
            define('IN_PHPBB', true);
            $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forums/';
            $phpEx = substr(strrchr(__FILE__, '.'), 1);
            include($phpbb_root_path . 'common.' . $phpEx);
            $user->session_begin();
            $auth->acl($user->data);
            if (!$user->data["is_registered"]) {
        ?>
        <div class="logged_out">
            <form action="./forums/ucp.php?mode=login" method="post" enctype="multipart/form-data">
                <input type="text" placeholder="username" style="height:20px;" maxlength="20" size="17px" name="username"  />
                <input type="password" placeholder="password" style="height:20px;" maxlength="50" size="16px" name="password"  />
                <div class="button">
                    <input type="image" name="login" value="Log in" src="images/login.png"  width="28px" onmouseout="this.src='images/login.png'" onmouseover="this.src='images/loginhover.png'" onmouseout="t">
                </div>
                <div class="logged_out_txt">
                    <br>
                    <input type="checkbox" name="autologin" id="autologin" />
                    <font size="2" color="#BDBDBD">
                        Remember Me
                        <div class="forgot">
                            <font size="2">
                                <a href="forums/ucp.php?mode=sendpassword">Forgot Password?</a>
                            </font>
                        </div>
                        <div class="New">
                            <br>
                            <a href="forums/ucp.php?mode=register">New Member? Register Now!</a>
                        </div>
                </div>
                <input type="hidden" name="redirect" value="./../index.php" />
            </form>
        </div>
        <?php
            }
            else {
                echo "<div class='logged_in'>";
                echo "<div class='welcome'>" . $user->data['username'];
                "</div>";
                echo "<br><div class='account'><a href=\"logout.php\">Logout</a></div>";
                echo "<div class='account'><a href=\"forums/ucp.php?i=pm&folder=inbox\">Messages</a></div>";
                echo "<div class='account'><a href=\"forums/ucp.php\">My Account</a></div>";
                echo "</div>";
            }
        ?>
    </li>
</div>

CSS:

.login_box {
    float: right;
    width: 330px;
    height: 75px;
    margin-top: 7px;
    margin-right: -5px;
    list-style: none;
}
.login_box li {
}
.login_box li a {
    color: #BDBDBD;
    text-decoration: none;
    padding-left: 60px;
    padding: 0px;
}
.logged_in {
    background-image: url(images/bg_login2.png);
    border: 3px solid#000000;
    outline: 1px solid#BDBDBD;
    width: 304px;
    height: 55px;
    margin-left: -2px;
    padding-top: 5px;
}
.logged_out {
    margin-right: 38px;
}
.logged_out_txt {
    margin-top: -20px;
}

解决方案

Update the following changes to your CSS classes and it will be alright.

CSS

.logged_out {
    margin-right: 22px;
    position: relative;
}

.button {
    position: absolute;
    top: 0;
    right:0;
}

Remove display:inline; float:right; margin-top: 0; and margin-left: 4px from .button

这篇关于移动页面刷新的HTML按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆