html - 在标记小说时,我应该使用多个 p 元素还是一个带有 br 元素的 p 元素?
问题描述
我想知道我正在做的是否是“正确的方法”,即使在编程中(认为 HTML 并不是真正的编程语言)有几种方法可以解决问题。
我目前正在通过制作一个用户可以在其中阅读小说/书籍的网站来应用我目前对 HTML 的了解。我想知道是否应该为每个段落使用多个 p 元素,还是应该为具有多个 br 元素的单个段落使用。
我目前正在使用多个 p 元素。所以我怀疑这是否是正确的方法。有时书中有些段落只占用在线,通常是在与字符进行对话时,所以我的 html 文件中有很多 p 元素。
<p>
Look, I didn't want to be a half-blood.
</p>
<p>
If you're reading this because you think you might be one, my advice
is: close this book right now. Believe whatever lie your mom or dad told you about your birth, and try to lead a normal life.
</p>
<p>
Being a half-blood is dangerous. It's scary. Most of the time, it gets you killed in paiful, nasty ways.
</p>
<p>
If you're a normal kid, reading this because you think it's fiction, great. Read on. I envy you for being able to believe that none of this ever happened.
</p>
<p>
But if you recognize yourself in thses pages—if you feel something stirring inside—stop reading immediately. You might be one of us. And once you know that, it's only a matter of time before <em>they</em> sense it too, and they'll come for you.
</p>
<p>
Don't say I didn't warn you.
</p>
<hr>
<p>
My name is Percy Jackson.
</p>
<p>
I'm twelve years old. Until a few months ago, I was a boarding student at Yancy Academy, a private school for troubled kids in upstate New York.
</p>
<p>
Am I a troubled kid?
</p>
<p>
Yeah. You could say that.
</p>
<p>
I could start at any point in my short miserable life to prove it, but things really started going bad last May, when our sixth-grade class took a field trip to Manhattan—twenty-eight mental-case kids and two teachers on a yellow school bus, heading to the Metropolitan Museum of Art to look at ancient Greek and Roman stuff.
</p>
<p>
I know—it sounds like torture. Most Yancy field trips were.
</p>
<p>
But Mr. Brunner, our Latin teacher, was leading this trip, so I had hopes
</p>
所以结果看起来和书中的一样。但我唯一想知道的是,是否只使用单个 p 元素然后使用不同的 br 元素会更好。
解决方案
标签用于段落,<p>
所以如果它们真的是段落(并不总是很容易说),它们都应该用自己的<p>
标签包装。<br>
如果您知道我的意思,我喜欢考虑更像是 shift+enter...如果您需要我的建议,请坚持当前的方法,并且<br>
仅在非常明显时才使用。
推荐阅读
- ansible - Ansible:使用 with_items 循环两个寄存器变量
- ruby-on-rails - 如何使用选择添加三元条件
- mysql - 如何使用所见即所得的文本编辑器添加图像和文本并将它们一起保存到 MySQL 数据库中?
- google-apps-script - 如何查找正在运行的应用程序脚本?
- forms - 如何将露天权威现场控制与 OOTB ftl 集成?
- azure - 如何将大型有效载荷(即超过 150 KB)传递给其他功能?
- python - 如何使用python将值或文本添加到元素上方的其他级别
- jmeter - 有没有办法在不同的机器上分布运行不同的 jmx 脚本?
- android - 网址多次在 webview 中显示
- opencl - OpenCL 内核:__global 变量中的并行求和