坏?或不? (但我想我已经知道......) [英] Bad? Or not? (But I think I already know...)

查看:60
本文介绍了坏?或不? (但我想我已经知道......)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样做很糟糕:


< h3>某些标题或其他...< a href =" #pagetop">返回顶部< / a> < / h3>


我有一种感觉......我的问题是我正在使用CSS来将H3设计为

块横跨整个包含元素。我想要< a>

出现在标题旁边,但我确定这是不好的做法(对于屏幕

读者和标题级导航等等)


所以...这样做是否可以接受:


< span>< h3>某些标题或其他......< / h3> < a href =" #pagetop">返回

top< / a>< / span>


或者嵌套< H3>在< span>中做一些可怕的文件

结构?


评论,拜托! :)


P.

解决方案

&the; Plankmeister" < PL ****************** @ hotmail.com>在消息中写道

news:3f *********************** @ dread11.news.tele.d k ... <这是坏事:

< h3>某些标题或其他...< a href =" #pagetop">返回顶部< / a> < / h3>

我有一种感觉......我的问题是我正在使用CSS来将H3设置为跨越整个包含元素的
a块。我想要< a>
出现在标题旁边,但我确定这是不好的做法(对于屏幕阅读器和标题级导航等等)

所以......是这样做可以接受:

< span>< h3>某些标题或其他......< / h3>< a href =" #pagetop">返回
top< / a>< / span>




我在规范中没有证实这一点,但我想< h3>不是内联

元素,因此使用span是不正确的。更好的解决方案可能是:


< div class =" myheading3">

< h3> Hello World< / h3>

< a href =" #pagetop" class =" toplink">返回顶部< / a>

< / div>


输入< a>在< h3>中很可能是不正确的语义。

希望这会有所帮助。

问候,

Peter Foti


Plankmeister写道:

这样做不好:

< h3>某些标题或其他...< a href =" #pagetop">返回顶部< / a>< / h3>

我感觉它是...


我会的这么说,因为''返回顶部''文本不是标题的一部分。


我的问题是我正在使用CSS来将H3设置成一个块跨越
整个包含元素。我想要< a>出现在
标题旁边,但我确定这是不好的做法(对于屏幕阅读器和
标题级导航等等)

所以......是这样做可以接受:

< span>< h3>某些标题或其他......< / h3>< a href =" #pagetop">返回
top< / a>< / span>

或者嵌套< h3>在< span>中做一些可怕的文件
结构?




< span>元素不能包含块级元素,因此在打开< h3>时会立即得到

验证错误。当您尝试关闭< span>时,元素(使用XHTML)或

元素(带有HTML)。


在实践中,如果您在某些浏览器中按照您想要的方式设置内容有困难,我不会感到惊讶,作为< h3>元素不会在< span>内< span>内你想要的元素。


使用< div>元素代替< span>元素,你应该没事。

一个更好的方法是选择一个更合适的元素,但

而不知道上下文,我不能建议一个(甚至可能没有

一个)。


-

Jim Dabell


" Plankmeister" < PL ****************** @ hotmail.com> schreef在bericht

新闻:3f *********************** @ dread11.news.tele.d k ... <这是坏事:

< h3>某些标题或其他...< a href =" #pagetop">返回顶部< / a> < / h3>

我有一种感觉......我的问题是我正在使用CSS来将H3设置为跨越整个包含元素的
a块。我想要< a>
出现在标题旁边,但我确定这是不好的做法(对于屏幕阅读器和标题级导航等等)

所以......是这样做可以接受:

< span>< h3>某些标题或其他......< / h3>< a href =" #pagetop">返回
top< / a>< / span>

或者嵌套< h3>在< span>中做一些可怕的文件
结构?

评论,拜托! :)

P。




< h3>< span>某些标题或其他...< / span>< / h3>

< a href =" #pagetop">返回顶部< / a>


或者这不是你想要的?

-

如有问候,

Samu?l van Laere

荷兰
http://samuel.phpindex.nl


Is doing this bad:

<h3>Some title or other...<a href="#pagetop">back to top</a></h3>

I have a feeling it is... My problem is I''m using CSS to style the H3 into a
block that spans the whole containing element. I would like the <a> to
appear next to the title, but I''m sure this is bad practice (for screen
readers and heading-level navigation etc etc)

So... is it acceptable to do this:

<span><h3>Some title or other...</h3><a href="#pagetop">back to
top</a></span>

Or does nesting the <h3> in a <span> do something horrible to the document
structure?

Comments, please! :)

P.


解决方案

"The Plankmeister" <pl******************@hotmail.com> wrote in message
news:3f***********************@dread11.news.tele.d k...

Is doing this bad:

<h3>Some title or other...<a href="#pagetop">back to top</a></h3>

I have a feeling it is... My problem is I''m using CSS to style the H3 into a block that spans the whole containing element. I would like the <a> to
appear next to the title, but I''m sure this is bad practice (for screen
readers and heading-level navigation etc etc)

So... is it acceptable to do this:

<span><h3>Some title or other...</h3><a href="#pagetop">back to
top</a></span>



I haven''t confirmed this in the spec, but I think <h3> is NOT an inline
element, so using span would be incorrect. A better solution might be:

<div class="myheading3">
<h3>Hello World</h3>
<a href="#pagetop" class="toplink">back to top</a>
</div>

Putting the <a> in the <h3> is most likely incorrect semantics.
Hope this helps.
Regards,
Peter Foti


The Plankmeister wrote:

Is doing this bad:

<h3>Some title or other...<a href="#pagetop">back to top</a></h3>

I have a feeling it is...
I''d say so, as the ''back to top'' text isn''t part of the header.

My problem is I''m using CSS to style the H3 into a block that spans the
whole containing element. I would like the <a> to appear next to the
title, but I''m sure this is bad practice (for screen readers and
heading-level navigation etc etc)

So... is it acceptable to do this:

<span><h3>Some title or other...</h3><a href="#pagetop">back to
top</a></span>

Or does nesting the <h3> in a <span> do something horrible to the document
structure?



<span> elements cannot contain block-level elements, so you''d get a
validation error immediately upon opening the <h3> element (with XHTML), or
when you attempt to close the <span> element (with HTML).

In practice, I wouldn''t be surprised if you had difficulty styling things
the way you want in some browsers, as the <h3> element wouldn''t be within
the <span> element as you intend.

Use a <div> element in place of the <span> element, and you should be fine.
An even better approach would be to pick a more suitable element, but
without knowing the context, I can''t suggest one (and there may not even be
one).

--
Jim Dabell


"The Plankmeister" <pl******************@hotmail.com> schreef in bericht
news:3f***********************@dread11.news.tele.d k...

Is doing this bad:

<h3>Some title or other...<a href="#pagetop">back to top</a></h3>

I have a feeling it is... My problem is I''m using CSS to style the H3 into a block that spans the whole containing element. I would like the <a> to
appear next to the title, but I''m sure this is bad practice (for screen
readers and heading-level navigation etc etc)

So... is it acceptable to do this:

<span><h3>Some title or other...</h3><a href="#pagetop">back to
top</a></span>

Or does nesting the <h3> in a <span> do something horrible to the document
structure?

Comments, please! :)

P.



<h3><span>Some title or other...</span></h3>
<a href="#pagetop">back to top</a>

Or is this not what you want?
--
With regards,
Samu?l van Laere
the Netherlands
http://samuel.phpindex.nl


这篇关于坏?或不? (但我想我已经知道......)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆