<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>assignment 4</title>
<h1>Assignment4- CSS basics</h1>
<style>
.special
{
text-align:justify;
text-indent:10px;
}
它告诉我元素样式是不允许的,请帮忙
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>assignment 4</title>
<h1>Assignment4- CSS basics</h1>
<style>
.special
{
text-align:justify;
text-indent:10px;
}
它告诉我元素样式是不允许的,请帮忙
<h1>
(与其他内容元素一样)不能出现在<head>
标签中。
因此,解析器假定您关闭<head>
并启动了<body>
.
<style>
标签只能出现在<head>
标签中。
由于解析器之前隐式启动了<body>
,因此您会收到错误消息。
h1
不属于该部分head
。相反,它应该在body
.
它应该看起来像:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>assignment 4</title>
<style>
.special {
text-align:justify;
text-indent:10px;
}
</style>
</head>
<body>
<h1>Assignment4- CSS basics</h1>
</body>
</html>
You need to close the head section before including any HTML content. The css should appear within the head section but the H1 tag within the body. ie.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>assignment 4</title>
<style>
.special
{
text-align:justify;
text-indent:10px;
}
</style>
</head>
<body>
<h1>Assignment4- CSS basics</h1>
</body>
</html>