我在代码中使用的第一个h1标记与我要使用的样式一起工作,但是第二个和第三个标记不起作用。第二个标签根本没有成为标题(只是简单的小文本),第三个标签太大了。
h1 {
color: #2B2B2B;
white-space: normal;
word-break: break-all;
font-family: Georgia;
text-align: center;
}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<img src="Logo.png" alt:"">
<div class="container">
<nav>
<ul>
<li>About Us</li>
<li>Services</li>
<li>Continuing Education Courses</li>
<li>Support Groups & Workshops</li>
<li>First Appointment & Fees Insurance</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
<hr>
<div class="profile-box">
<img src="Group 1.png" alt="" align="center" width="300px" height="100px">
<main>
<section>
<h1>Grounding and Resourcing Technique Giveaway</h1>
<h2>
Being a mental health clinician can be such an empowering and rewarding role. You can change,
help, and nourish so many of those struggling with everyday life. Through the responsibilities
you take on while helping others, it’s so important to practice grounding and resourcing
techniques with your clients.
</h2>
</section>
<div class="child-one child" <h1>Bill Maceus, Co-Founder of XYZ is giving away a FREE handout for
grounding and resourcing methods.</h1>
<img src="Rectangle 817.png" alt="" align="left">
<h2>
Learn ways to keep your client grounded by establishing comfortability, learning breathing and
body awareness techniques, object-based resourcing, and so much more. This handout will help you
overcome some of those challenges you face daily as a mental health clinician while working with
clients.
</h2>
<hr>
<h1>Simply fill out the form below to download.</h1>
<h2>You will be sent a copy to your email.</h2>
</div>
</main>
</div>
</div>
</body>
发布于 2022-08-10 01:31:29
HTML中有一个语法错误。以下一行不完整:
<div class="child-one child"
在这一行之后的任何事情都可能产生意想不到的结果。您需要完成开始的div标记(如果这是完整的代码,也可以在某个地方关闭它)。
<div class="child-one child">
发布于 2022-08-10 01:34:09
使用<style>标记将css括起来。
<style>
h1 {
color: #999999;
white-space:normal;
word-break: break-all;
font-family: Georgia;
text-align:center;
}
</style>您也忘记了div的结束标记,尽管不完全确定要将结束标记的位置放在哪里。
<div class="child-one child"></div>发布于 2022-08-10 01:55:13
如果您正在使用VS代码编辑器,如果您还没有避免这种问题和更漂亮的扩展,请安装自动关闭标记扩展,这对您查看代码的组织和容易看出出了什么问题有很大帮助。
链接:
自动关闭标记扩展- https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag
更漂亮的扩展- https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
https://stackoverflow.com/questions/73299684
复制相似问题