我有以下代码。只有 showRegistrationForm() 函数中回显文本的第一行得到我的 Arial, sans-serif 字体样式。
但是,“body”和“form”标签样式中的“color”都可以正常工作。第一行是红色和无衬线字体。
但是表单中的所有文本虽然采用了蓝色样式,但却是衬线 Courier 字体!
只有第一行写着“请提供以下信息 -- '*' 表示必填字段。” 显示为无衬线字体。
注意:奇怪的是,“颜色”样式效果很好——“请提供...”行是红色的,表单文本是蓝色的。
只有 sans-serif 字体样式消失了——表单中的所有文本都是 courier 外观的衬线字体。 注意:如果我去掉“form”样式标签,我会看到相同的“只有第一行是无衬线字体”。当只有‘ body ’ 样式标签存在,所有文本都是红色的,但只有第一行文本是 san-serif,其余是所有表单文本中的 Courier 文本。
为什么?
<html>
<head>
<style>
body
{
color: rgb(255,0,0);
font-family: Arial, sans-serif;
}
form
{
color: rgb(0,0,255);
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<?php
showRegistrationForm();
function showRegistrationForm()
{
echo "Please provide the following info -- a * denotes a required field.";
echo '<br /><form action="newUserRegistration.php" method="post">';
echo '<br />Screen name * : <input type="text" name="screenName" />';
echo '<br />First name : <input type="text" name=$firstNameLabel />';
echo '<br />Last name * : <input type="text" name=$lastNameLabel />';
echo '<br />Phone : <input type="text" name=$phoneLabel />';
echo '<br />Email * : <input type="text" name=$emailLabel size=40 />';
echo '<br /><input type="submit" name="addNewRegUserBtn" value="Register Now!" />';
echo '<br /></form>';
}
?>
</body>
</html>
最佳答案
你有 <pre>
使用中的标签。删除它,它应该可以工作
关于php - 我的 php 端表单不接受 CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8721021/