gpt4 book ai didi

html - CSS 在我的页面上不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 03:59:16 25 4
gpt4 key购买 nike

这是我的新 PHP

    <?php

/**
* Make sure you started your'e sessions!
* You need to include su.inc.php to make SimpleUsers Work
* After that, create an instance of SimpleUsers and your'e all set!
*/

session_start();
require_once(dirname(__FILE__)."/simpleusers/su.inc.php");

$SimpleUsers = new SimpleUsers();

// Login from post data
if( isset($_POST["username"]) )
{

// Attempt to login the user - if credentials are valid, it returns the users id, otherwise (bool)false.
$res = $SimpleUsers->loginUser($_POST["username"], $_POST["password"]);
if(!$res)
$error = "You supplied the wrong credentials.";
else
{
header("Location: users.php");
exit;
}

} // Validation end

echo '<link href="css/style.css" rel="stylesheet">';


?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>CSS3 Button Demo</title>

<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php if( isset($error) ): ?>
<p>
<?php echo $error; ?>
</p>
<?php endif; ?>

<form method="post" action="">


<input type="username" name="username" id="username" placeholder="Username" />

<input type="password" name="password" id="password" placeholder="Password" />

<input type="submit" name="submit" value="Login" />

</body>
</html>

<?php if( isset($error) ): ?>
<p>
<?php echo $error; ?>
</p>
<?php endif; ?>

<form method="post" action="">

这是我的新 CSS:

    input[type=password] {
background: url(../img/keyIcon.png) 12px 11px no-repeat, -moz-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url(../img/keyIcon.png) 12px 11px no-repeat, -webkit-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url(../img/keyIcon.png) 12px 11px no-repeat, -o-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url(../img/keyIcon.png) 12px 11px no-repeat, -ms-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url(../img/keyIcon.png) 12px 11px no-repeat, linear-gradient(to bottom, #f7f7f8 0%, #ffffff 100%);
border-radius: 3px;
border: none;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset, 0 -1px 0 rgba(0, 0, 0, 0.05) inset;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
font-family: "Helvetica Neue", sans-serif;
font-size: 13px;
color: #222222;
position: relative;
height: 36px;
width: 300px;
padding-left: 30px;
}
input[type=password]::-webkit-input-placeholder {
color: #999999;
}
input[type=password]:-moz-placeholder {
color: #999999;
}
input[type=password]:focus {
box-shadow: 0 1px 0 #2392f3 inset, 0 -1px 0 #2392f3 inset, 1px 0 0 #2392f3 inset, -1px 0 0 #2392f3 inset, 0 0 4px rgba(35, 146, 243, 0.5);
outline: none;
background: url(../img/keyIcon.png) 12px 11px no-repeat, #ffffff;
}

input[type=username] {
background: url() 12px 11px no-repeat, -moz-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url() 12px 11px no-repeat, -webkit-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url() 12px 11px no-repeat, -o-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url() 12px 11px no-repeat, -ms-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
background: url() 12px 11px no-repeat, linear-gradient(to bottom, #f7f7f8 0%, #ffffff 100%);
border-radius: 3px;
border: none;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset, 0 -1px 0 rgba(0, 0, 0, 0.05) inset;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
font-family: "Helvetica Neue", sans-serif;
font-size: 13px;
color: #222222;
position: relative;
height: 36px;
width: 300px;
padding-left: 30px;
}
input[type=username]::-webkit-input-placeholder {
color: #999999;
}
input[type=username]:-moz-placeholder {
color: #999999;
}
input[type=username]:focus {
box-shadow: 0 1px 0 #2392f3 inset, 0 -1px 0 #2392f3 inset, 1px 0 0 #2392f3 inset, -1px 0 0 #2392f3 inset, 0 0 4px rgba(35, 146, 243, 0.5);
outline: none;
background: url() 12px 11px no-repeat, #ffffff;
}

输入框(密码、用户名)没有以 CSS 为主题,它们只是使用默认的。相同的代码(减去 PHP)在 HTML 中工作正常,关于导致 CSS 在 PHP 中无效的任何想法?我检查了其他一些问题并重新格式化了代码 2 次。此外,一旦我完成这项工作,我将如何使用 CSS 将登录框居中?

编辑:现在只有用户名框没有主题 - 检查我所做的更改。

谢谢!

最佳答案

你的头元素很乱。将其粘贴到适当的位置,让我知道是否可以解决任何问题。

<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">

h1
{
color: #000000;
border-bottom: 2px solid #000000;
margin-bottom: 15px;
}

p { margin: 10px 0px; }
p.faded { color: #A0A0A0; }
</style>
</head>

您的 style.css 在您的标签内被调用。

关于html - CSS 在我的页面上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22339995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com