简体   繁体   English

H1标签不起作用

[英]H1 tag not working

Below is a portion of my html code but the css for the h1 tag doesn't seem to be working. 以下是我的html代码的一部分,但h1标签的css似乎无法正常工作。 What seems to be the problem? 似乎是什么问题?

h1 {
    font-size: 20px; 
    color: #445668; 
    text-transform: uppercase;
    text-align: center; 
    margin: 0 0 35px 0; 
    text-shadow: 0px 1px 0px #f2f2f2;
}

</style>
</head>
<body>
<div id="box">
<form id="truth">

<h1> Truth </h1>
First Name: <input type="text" name="firstname"  maxlength="30" /> <br>
Last Name: <input type="text" name="lastname"  maxlength="30"/> <br>
Email: <input type="text" id="email" /> <br>
Male <input type="radio" name="gender" value="male"/>
Female <input type="radio" name="gender" value="female"/> <br>
Date to be performed:<input type="date" name="date"/><br>
Victim:  <input type="text" name="victim"  maxlength="30" />
<input type="submit" onclick="validateEmail();" />

</form>
</div>
</body>
</html>

Try this code: 试试这个代码:

      <html>
      <style>
      h1 {
       font-size: 20px; 
       color: red; 
       text-transform: uppercase;
       text-align: center; 
       margin: 0 0 35px 0; 
       text-shadow: 0px 1px 0px #f2f2f2;
         }
       </style>
       </head>
       <body>
       <div id="box">
       <form id="truth">

       <h1> Truth </h1>
       First Name: <input type="text" name="firstname"  maxlength="30" /> <br>
       Last Name: <input type="text" name="lastname"  maxlength="30"/> <br>
       Email: <input type="text" id="email" /> <br>
       Male <input type="radio" name="gender" value="male"/>
       Female <input type="radio" name="gender" value="female"/> <br>
       Date to be performed:<input type="date" name="date"/><br>
       Victim:  <input type="text" name="victim"  maxlength="30" />
       <input type="submit" onclick="validateEmail();" />

       </form>
       </div>
       </body>
       </html>

尝试#box h1 {“您的样式”}或#box #truth h1 {“您的样式”}

The problem is with the character encoding of your source code, not sure how you wrote it but copying into notepad and re-typing the line "color:#445668;" 问题出在源代码的字符编码上,不知道如何编写,而是复制到记事本中并重新键入“ color:#445668;”行。 solves the problem. 解决了问题。 Guessing that you are editing linux code on a windows machine or vice versa. 猜测您正在Windows计算机上编辑Linux代码,反之亦然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM