我已经看过我的问题的一个变体被问过几次,但是那些实例的所有内容都没有对我有用。简而言之,我的HTML或CSS有什么问题,标签样式不起作用?
label {
font-family: Calibri, Arial, sans-serif;
font-size: 20px;
color: #ff0000;
}

<form action="index.php" method="post">
<h2>Add New Location</h2><br>
<label for="name">Location: </label>
<input type="text" size="75" name="name"><br>
<input type="submit" value="Add">
<input type="hidden" name="content" value="add_new_location">
</form>
&#13;
它必须是显而易见的,但在3小时后我投降了。
答案 0 :(得分:0)
您的代码存在的问题是您没有加载CSS。代码非常好。也许这是运行代码的程序的问题?我完全得到了这个结果。我相信确切的问题是你没有找到样式表的链接。您可以通过使用<link rel="stylesheet" href="/styles/site.css">
(信用卡@LeeKowalkowski)来实现这一点。另一个可能的简单选择是使用<style></style>
标签并将您的CSS放在其中。在你的情况下,它将是:
<style>
label {
font-family: Calibri, Arial, sans-serif;
font-size: 20px;
color: #ff0000;
}
</style>
<form action="index.php" method="post">
<h2>Add New Location</h2><br>
<label for="name">Location: </label>
<input type="text" size="75" name="name"><br>
<input type="submit" value="Add">
<input type="hidden" name="content" value="add_new_location">
</form>