用于打印替代文本的CSS属性? [英] CSS property for printing alternative text?
问题描述
嗨
我有一个标题为gif的标题:
< h1>< img src =" mytitle。 GIF" alt ="这是我的标题">< / h1>
所以这是基于文本的浏览器和搜索引擎友好且可以轻松
用样式表格式化。
现在我有一个单独的media =" print"样式表。由于标题gif确实
在打印时看起来不太好,因此有一个CSS属性
输出alt属性中的文本会非常好。
display:none使图像在没有替换的情况下消失。我可以
复制h1标签并给出两个实例类名,可以在相应的样式表中定义
as display:none,但这会让人感到困惑
各类非CSS浏览器。我会喜欢这样的东西:alttext。
有没有办法做到这一点?
感谢您的每一个提示。
Markus
Hi
I have a title with a title gif:
<h1><img src="mytitle.gif" alt="This is my title"></h1>
So this is text-based browser and search-engine friendly and can be easily
formatted with a style sheet.
Now I have a separate stylesheet for media="print". As the title gif does
not look very good when printed it would be very nice to have a CSS property
that outputs the text in the alt attribute.
display:none makes the image disappear without a replacement. I could
duplicate the h1 tag and give both instances class names that can be defined
as display:none in the appropriate style sheet, but that would confuse
non-CSS browsers of all kinds. I would love something like display:alttext.
Is there a way to do that?
Thanks for every hint.
Markus
推荐答案
" Markus Ernst" < derernst@NO#SP#AMgmx.ch>写道:
"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote:
现在我有一个单独的media =" print"样式表。由于标题gif在打印时看起来不太好,因此有一个CSS属性
可以输出alt属性中的文本。
Now I have a separate stylesheet for media="print". As the title gif does
not look very good when printed it would be very nice to have a CSS property
that outputs the text in the alt attribute.
img:after {display:block; content:attr(alt)}
不能在IE中工作。
-
Spartanicus
img:after{display:block;content:attr(alt)}
Won''t work in IE.
--
Spartanicus
2004年2月26日星期四,Markus Ernst写道:
On Thu, 26 Feb 2004, Markus Ernst wrote:
我有一个标题为gif的标题:
< h1>< img src =" mytitle.gif" alt ="这是我的标题">< / h1>
所以这是基于文本的浏览器和搜索引擎友好的
I have a title with a title gif:
<h1><img src="mytitle.gif" alt="This is my title"></h1>
So this is text-based browser and search-engine friendly
不,不是。 < H1>搜索引擎是空的。
No, it isn''t. <h1> is empty for search engines.
2004年2月26日星期四18:21:09 +0100,Markus Ernst< derernst @ NO#SP#AMgmx .ch>
写道:
On Thu, 26 Feb 2004 18:21:09 +0100, Markus Ernst <derernst@NO#SP#AMgmx.ch>
wrote:
嗨
我有一个标题为gif的标题:
>< h1>< img src =" mytitle.gif" alt ="这是我的标题">< / h1>
所以这是基于文本的浏览器和搜索引擎友好的,可以轻松
格式化样式表。
现在我有一个单独的media =" print"样式表。由于标题gif在打印时看起来不太好,因此有一个CSS
属性可以输出alt属性中的文本。
Hi
I have a title with a title gif:
<h1><img src="mytitle.gif" alt="This is my title"></h1>
So this is text-based browser and search-engine friendly and can be
easily
formatted with a style sheet.
Now I have a separate stylesheet for media="print". As the title gif does
not look very good when printed it would be very nice to have a CSS
property
that outputs the text in the alt attribute.
凌乱,但确实有效。
< h1 class =" noscreen">这是我的头衔< / h1>
< h1 class =" noprint">< img src =" mytitle.gif" alt ="这是我的标题">< / h1>
而且样式显然是屏幕css中的noscreen {display:none;}和
noprint {display:none;}在print css中。
Messy, but it works.
<h1 class="noscreen">This is my title</h1>
<h1 class="noprint"><img src="mytitle.gif" alt="This is my title"></h1>
And the style is obviously noscreen {display:none;} in the screen css and
noprint {display:none;} in the print css.
这篇关于用于打印替代文本的CSS属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!