- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在编写 HTML 页面(特别是包含大量文本内容)时,有时可以选择使用 DIV
或 P
元素。概念规则是:think semantically, use P
for text paragraphs .
我发现的一个问题是,现实世界中的段落概念并不总是与 P 元素不能包含 block 元素 的 HTML 限制相得益彰。在现实世界中,一个段落有时确实包含文本 block ——尤其是引文。以 P. G. Wodehouse 的这段文字为例:
The odd part of it was that after the first shock of seeing all this frightful energy the thing didn't seem so strange. I've spoken to fellows since who have been to New York, and they tell me they found it just the same. Apparently there's something in the air, either the ozone or the phosphates or something, which makes you sit up and take notice. A kind of zip, as it were. A sort of bally freedom, if you know what I mean, that gets into your blood and bucks you up, and makes you feel that
God's in His Heaven:
All's right with the world,and you don't care if you've got odd socks on. I can't express it better than by saying that the thought uppermost in my mind, as I walked about the place they call Times Square, was that there were three thousand miles of deep water between me and my Aunt Agatha.
查看此内容的自然(语义)方式是作为带有子 block 元素的一个段落。但是在 HTML 中,你必须选择
制作三个 P 段落(您应该做一些调整,例如,最后一个伪段落可能有错误的边距或缩进 - 但最重要的是,它在语义和结构上都是不正确的)
将内部引号编码为内联元素,一个带有多个 BR 的 SPAN(丑陋,很难对所有元素应用样式)
使整个段落成为一个 DIV(不可行/不一致,如果其他段落被编码为 P 元素)
我不喜欢任何一个选项 - 我看不到其他选项;因此,决定何时使用 P 的语义标准对我来说仍然不太令人满意。
另一个类似的例子,来自another PGW opus如下:
有什么处理这种情况的建议吗?
最佳答案
你问的是完整段落,但引用是这里的真正问题 - 我认为 <q>
的混合体, <br>
CSS 是合适的,因为诗歌是换行符具有一定意义的情况之一。通过一个类来识别特定的内联引述是一首诗的摘录,您可以获得所需的样式。
http://jsfiddle.net/insin/af2Uz/
<!doctype HTML>
<html>
<head>
<title>Poem Quoting</title>
<style type="text/css">
p { text-indent: 1em; }
q.poem { display: block; margin: 2em; font-style: italic; text-indent: 0; }
q.poem:before, q.poem:after { content: ''; content: none; }
</style>
</head>
<body>
<p>
The odd part of it was that after the first shock of seeing all this
frightful energy the thing didn't seem so strange. I've spoken to fellows
since who have been to New York, and they tell me they found it just the
same. Apparently there's something in the air, either the ozone or the
phosphates or something, which makes you sit up and take notice. A kind of
zip, as it were. A sort of bally freedom, if you know what I mean, that
gets into your blood and bucks you up, and makes you feel that
<q class="poem">God's in His Heaven:<br>All's right with the world,</q>
and you don't care if you've got odd socks on. I can't express it better
than by saying that the thought uppermost in my mind, as I walked about the
place they call Times Square, was that there were three thousand miles of
deep water between me and my Aunt Agatha.
</p>
</body>
</html>
...但是,如果没有 CSS,这看起来会很糟糕,所以我会花时间以技术上最正确的方式表达准确的语义,使用 <blockquote>
并将周围的文本拆分为两个 <p>
s 用一个类来指示 <p>
之一s 真的是一个延续。
如果理论与您在尖端工作时必须处理的内容不相符,那么您只能将理论应用到此为止 - 使用您不特别喜欢的方法之一的真正损失是什么?如果在某个阶段,你开始写一些确实依赖于结果文档结构的东西,那么如果你未能在这些场景中始终如一地使用相同的方法(能够依赖于像“对待”这样的规则,这只会是一个障碍 block 引号后跟 p.continuation 作为前面 p"的成员)。
关于html - 建议处理带有 block 内容的段落?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5812793/
我是一个相对较新的程序员; CS 学士学位,大学毕业大约 2 年,主要使用 C# 中的 .NET。我对 SQL 交互/脚本编写相当流利,并且对 ASP.NET 做了一些工作(主要是维护现有站点)。 我
我计划开发一个简单的解决方案,使我能够即时执行非常基本的视频流分析。我以前从未做过类似的事情,因此这是一个非常笼统和开放的问题。主要重点是检查流是否正常运行,例如 - 卡住帧、黑屏以及音频是否存在。同
我正在考虑重组一个大型 Maven 项目...... 我们当前结构的基本概述: build [MVN plugins, third party dependency management]:5.1
我需要有关附加查询的建议。该查询执行了一个多小时,并根据解释计划进行了全表扫描。我对查询调优还很陌生,希望得到一些建议。 首先,为什么我要进行全表扫描,即使我使用的所有列都在其上创建了索引。 其次,有
我正在做一个项目,我需要在 4 个模型之间创建三个多对多关系。这是它的过程: 常见问题类别可以有许多常见问题子类别,反之亦然。 常见问题组可以有许多常见问题的子类别,反之亦然。 常见问题可以有许多常见
对于代码大小比语音质量更重要的 PIC 和/或 ARM 嵌入式系统,是否有任何易于使用的免费或廉价的语音合成库?现在似乎 1 meg 的封装被认为是“紧凑的”,但很多微 Controller 都比它小
我们正在使用 Solr 建议器功能进行 businessName 查找。当用户输入查询以及匹配的名称时,我们希望 solr 发送来自个人资料的其他属性,如 id、地址、城市、州、国家等字段。 我尝试使
我正在构建一个用户界面。我的计划将包括 4 个主要部分: 1) 顶部菜单 - TMainMenu。一个窗口的顶部 2) 主菜单 - TTreeView。一个窗口的左边。 TreeView的每一项=对应
我的公司需要一个任务管理系统来处理从“为X购买一台计算机”到“将一个人转移到另一个国家”这样简单的场景。简单的场景是由一个人处理的单个任务,而更大的任务可以分解为在工作流程中委派给多个人的多个子任务。
MarkLogic 服务器的林大小与实际内存的建议比率是多少?例如,我目前有一个 190GB 的数据库,并且该数据库随着时间的推移而不断增长。由于数据库会不断增长,我最终需要对该数据库进行集群。因此,
去年我收到了一个礼物,它是一个索尼 CMT700Ni 音频站,支持 wifi。它还具有类似于广播的功能,称为“PartyStreaming”。我目前正在挖掘内部,探索它,所以也许我可以结束拥有自己的“
有没有我可以阅读的研究论文/书籍可以告诉我针对手头的问题哪种特征选择算法最有效。 我试图简单地将 Twitter 消息识别为 pos/neg(首先)。我从基于频率的特征选择开始(从 NLTK 书开始)
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我正在浏览 stackoverflow 以查找有关使用 jUnit 进行测试的常见建议,但仍然有几个问题。我知道,如果要测试的方法很复杂,最好的方法是将其分成小的单独部分并测试每个部分。但问题是 -
我有一个方法如下 public List> categorize(List customClass){ List> returnValue = new ArrayList<>();
我的问题是,当按照下面的程序合并时,在最佳实践场景中,“将分支折叠回主干”程序的最后一步是正确的方法吗? 我已经使用 svn 很多年了。在我的个人项目中,我总是毫不犹豫地在主干上愉快地进行修改,并且在
我读过 UINavigationController当您想从 n 个屏幕跳转到第一个屏幕时,这是最佳选择。这样做需要以下代码: NSMutableArray *array=[[NSMutableArr
我有一个文件输入类。它在构造函数中有一个字符串参数来加载提供的文件名。但是,如果文件不存在,它就会退出。如果文件不存在,我希望它输出一条消息 - 但不确定如何...... 这是类(class): pu
我希望创建一个“您访问过的国家/地区” map - 就像您可能在 Facebook、TravelAdvisor 和诸如此类的网站上看到的那样。 我尝试过不同的闪光灯套件,但它们并不像我希望的那样先进。
我需要一些关于如何处理我想用 Perl 编写的脚本的建议。基本上我有一个看起来像这样的文件: id: 1 Relationship: "" name: shelby pet: 1
我是一名优秀的程序员,十分优秀!