Php 我的剧本一直在写;您的登录";在左上角的方框中

Php 我的剧本一直在写;您的登录";在左上角的方框中,php,Php,将style=“float:right;”“添加到div 或者最好将其放在一个单独的CSS文件中,在CSS类声明中,并将该类添加到您的div中 大概是 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php-login-advanced</title> <style type="text/css"> /

style=“float:right;”“
添加到div

或者最好将其放在一个单独的CSS文件中,在CSS类声明中,并将该类添加到您的div中

大概是

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>php-login-advanced</title>
    <style type="text/css">
        /* just for the demo */
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            margin: 10px;
        }
        label {
            position: relative;
            vertical-align: middle;
            bottom: 1px;
        }
        input[type=text]
        {    position: absolute;  
             display: block;
             top: 45px;
             right: 30px;
            }            

    input[type=password]
    {    position: absolute;
         display: block;
         top: 80px;
         right: 30px;
        }            
    input[type=submit]
    {    position: absolute;
         display: block;
         top: 115px;
         right: 30px;
        }            
    input[type=email] {      
        top: 30px;
        right: 25px;
        display: block;
        margin-bottom: 15px;
    }
    input[type=checkbox] {
        margin-bottom: 15px;
    }
</style>
</head>
<body>

<?php
// show potential errors / feedback (from login object)
if (isset($login)) {
if ($login->errors) {
    foreach ($login->errors as $error) {
        echo $error;
    }
}
if ($login->messages) {
    foreach ($login->messages as $message) {
        echo $message;
        }
    }
}
?>

<?php
// show potential errors / feedback (from registration object)
if (isset($registration)) {
    if ($registration->errors) {
        foreach ($registration->errors as $error) {
            echo $error;
        }
    }
    if ($registration->messages) {
        foreach ($registration->messages as $message) {
            echo $message;
        } 
    }
}
?>

这不是一个css/html对齐问题吗?你有任何css/样式吗?如果不是。。你需要从那里开始。(另外,您需要“您已登录”)您能告诉我们
header.php
中的内容吗?看起来您只是将“登录”消息直接回显到页面上,但如果您想将其放置在DOM中正常的“原始”位置之外的某个位置,则确实应该在
或其他块元素中执行此操作。
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>php-login-advanced</title>
    <style type="text/css">
        /* just for the demo */
        body {
            font-family: Arial, sans-serif;
            font-size: 12px;
            margin: 10px;
        }
        label {
            position: relative;
            vertical-align: middle;
            bottom: 1px;
        }
        input[type=text]
        {    position: absolute;  
             display: block;
             top: 45px;
             right: 30px;
            }            

    input[type=password]
    {    position: absolute;
         display: block;
         top: 80px;
         right: 30px;
        }            
    input[type=submit]
    {    position: absolute;
         display: block;
         top: 115px;
         right: 30px;
        }            
    input[type=email] {      
        top: 30px;
        right: 25px;
        display: block;
        margin-bottom: 15px;
    }
    input[type=checkbox] {
        margin-bottom: 15px;
    }
</style>
</head>
<body>

<?php
// show potential errors / feedback (from login object)
if (isset($login)) {
if ($login->errors) {
    foreach ($login->errors as $error) {
        echo $error;
    }
}
if ($login->messages) {
    foreach ($login->messages as $message) {
        echo $message;
        }
    }
}
?>

<?php
// show potential errors / feedback (from registration object)
if (isset($registration)) {
    if ($registration->errors) {
        foreach ($registration->errors as $error) {
            echo $error;
        }
    }
    if ($registration->messages) {
        foreach ($registration->messages as $message) {
            echo $message;
        } 
    }
}
?>
<div class="pull-right">
<link rel="stylesheet" type="text/css" href="mycss.css" />
.pull-right {
    float:right;
}