例如。 2 < br>< br>我的第一段。 < br>< br>我的第二段。 谢谢 Chris - 互动设计师 - SplashMedia http://splashmedia.co.nz 解决方案 Chris Goldie写道:从可访问性的角度来看,使用< P> over< br>?是否有任何优势? 例如,这两个例子的区别是什么,它们都可以访问吗? 例如。 1 < p>我的第一段。< / p> < p>我的第二段。< / p> 例如。 2 < br>< br>我的第一段。< br>< br>我的第二段。 后一个MEANS我的第一段我的第二段 前MEANS我的第一段 我的第二段 a屏幕阅读器应该这样渲染它们,所以你想要的意思将会丢失 非视觉用途的网站后者可能会令人困惑,因此不应该使用 ...< p>< / p>将内容显示为单个 段......这是一个概念性的想法,而不仅仅是文本 如何在页面上直观呈现 - eric www.ericjarvis.co.uk 嘿Lord不问我问题 我没有回答 Chris Goldie写道: 例如。 1 < p>我的第一段。< / p> < p>我的第二段。< / p> 例如。 2 < br>< br>我的第一段。< br>< br>我的第二段。 我我对网站的可访问性问题并不过分了解,但是我不会说b $ b确实要说两者在视觉上看起来都是段落, 默认情况下,前者通常是比后者更好的练习。 HTML元素的存在是为了向计算机描述它们的内容是什么。在您的第一个示例中,您有两个段落元素, 告诉计算机一些关于 文档结构的事情。在第二个例子中,你有一些带有 换行元素的任意文本,它没有提供关于 文本的任何有用信息。 在某些情况下,后者甚至可能是无效代码 - HTML 4.01 Strict和XHTML不允许BODY元素中的字符数据,所以 无论如何,你最终会将文本包装在其他元素中。为什么不使用 正确的? 9月13日星期六,Chris Goldie刻在永恒的卷轴上: 例如。 2 < br>< br>我的第一段。< br>< br>我的第二段。 Er不,不。你告诉HTML他们不是段落。现在你正在尝试 告诉_us_他们_are_段落。 有一个古老的格言,归功于Henry Spencer:如果你撒谎到 编译器,它会得到它的复仇;并且必须更强大地应用于HTML,您甚至可以___控制用户将应用于您的标记的HTML 渲染代理,而不是 会对您在程序源上使用的编译器进行处理 代码。 多年来它一直是虽然流行的浏览器 (又名Mosaic-spawn)处理过< br>作为一种命令向下移动 一行,还有其他浏览器将其理解为HTML规范中定义的 换行符。一旦一条线被打破了,b $ b被破坏了,它就会被打破,所以填充额外的< br>标签对它们没有 的影响:无论连续多少< br>他们得到了,他们 只是产生一个换行符,然后继续在 后立即渲染。 以示例为例HTML4.01中的定义: | BR元素强行中断(结束)当前文本行。 使用第二个br在< br>< br>那里_is_没有当前的文字行 要被打破,所以我认为说明这种行为是不公平的。 未定义。 From an accessibility point of view, is there any advange in using <P>over <br>?eg, whats the difference between these two examples, are they bothaccessible?Eg. 1<p>My first paragraph.</p><p>My second paragraph.</p>Eg. 2<br><br>My first paragraph.<br><br>My second paragraph.ThanksChris--Interaction Designer - SplashMedia http://splashmedia.co.nz 解决方案 Chris Goldie wrote: From an accessibility point of view, is there any advange in using <P> over <br>? eg, whats the difference between these two examples, are they both accessible? Eg. 1 <p>My first paragraph.</p> <p>My second paragraph.</p> Eg. 2 <br><br>My first paragraph. <br><br>My second paragraph.the latter MEANS "My first paragraph My second paragraphthe former MEANS "My first paragraphMy second paragraph"a screen reader should render them as such, so your intended meaning willbe lostfor non visual usage of the site the latter could be confusing and shouldtherefore not be used...<p></p> shows the content to be a singleparagraph...this is a conceptual idea not merely a matter of how the textis visually represented on the page--eric www.ericjarvis.co.uk"Hey Lord don''t ask me questionsThere ain''t no answer in me"Chris Goldie wrote: Eg. 1 <p>My first paragraph.</p> <p>My second paragraph.</p> Eg. 2 <br><br>My first paragraph. <br><br>My second paragraph.I''m not overly knowledgable about website accessibility issues, but Ido have to say that while both will visually appear to be paragraphs,by default, the former is generally better practice than the latter.HTML elements exist to describe to the computer what the contents ofthem are. In your first example, you have two "paragraph" elements,which tells the computer some things about the structure of thedocument. In the second example, you have some arbitrary text withline break elements, which doesn''t provide any useful information aboutthe text.In certain contexts the latter may even be invalid code -- HTML 4.01Strict and XHTML do not permit character data in the BODY element, soyou''d end up wrapping the text in other elements anyways. Why not usethe right ones?On Sat, Sep 13, Chris Goldie inscribed on the eternal scroll: Eg. 2 <br><br>My first paragraph. <br><br>My second paragraph.Er, no. You have told HTML they aren''t paragraphs. Now you''re tryingto tell _us_ that they _are_ paragraphs.There''s an old dictum, attributed to Henry Spencer: "If you lie to thecompiler, it will get its revenge"; and that has to apply even morestrongly to HTML, where you have even _less_ control over which HTMLrendering agent your users will be applying to your markup, than youwould have had over which compilers you used on your program sourcecode.For many years it''s been the case that although popular browsers(a.k.a "Mosaic-spawn") treated <br> as a sort of command "move down byone line", there were other browsers which understood it to be aline-break as defined in HTML specifications. And once a line hasbeen broken, it''s broken, so stuffing-in additional <br> tags had noeffect on them: no matter how many successive <br> they got, theysimply produced one line break, and continued rendering on theimmediately following line.Take for example the definition in HTML4.01:| The BR element forcibly breaks (ends) the current line of text.With the second "br" in <br><br> there _is_ no "current line of text"to be broken, so I think it''s fair to state that the behaviour isundefined. 这篇关于可访问性 - 使用&lt; P&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 12:14
查看更多