想删除img-border w / xhtml,而不是html [英] Want to remove img-border w/ xhtml, not html

查看:73
本文介绍了想删除img-border w / xhtml,而不是html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确保在FF或IE或任何其他浏览器中没有出现任何边框(围绕特定的小型博客按钮

图像)。我似乎无法使用xhtml来实现

,所以我恢复了


border =" 0"


里面的img标签。这当然不会验证为xhtml。它确实是我希望它做什么(在两个浏览器中摆脱边界),但我希望

我的所有代码都要经过验证,格式正确xhtml 。


如何使用xhtml或css正确执行此操作?


相关图片位于< http:// rjbox .net,大约在

页面的一半。


有问题的代码在这里:


99应该你碰巧同意这个& rsquo;我会在< a href =" http://no-www.org">< img

100哲学>
101 src =" http://no-www.org/images/blog-button.gif"

102 alt =" No-www.org"

103 title =" No-www.org"

104 border =" 0" />< / a:简而言之,使用www子域名为
105冗余且耗时的通信。没有它,互联网,媒体和社会都会变得更好。& nbsp;< br />< br />


-

// rj@panix.com //

解决方案

Russell Hoover写道:


我想确保没有边框(围绕特定的小博客) - 按钮

图像曾出现在FF或IE或任何其他浏览器中。我似乎无法使用xhtml来实现

,所以我恢复了


border =" 0"


里面的img标签。这当然不会验证为xhtml。



它也没有验证HTML 4.01严格。


它确实

我想要它做什么(在两个浏览器中摆脱边界),但我希望

我的所有代码都要经过验证,结构良好的xhtml。



当人们在这里说,有人总是出现并询问/为什么/

你想要那个。通常海报不知道,或认为他们知道

(他们想要最新的代码)。请注意(也许你已经是)

,XHTML并不是所有它都被破解(或被讨论)。机会是,你真的应该使用HTML 4.01严格的
。特别是因为......好吧,

见下面的评论。


>

我该怎么办?这正确使用xhtml或css?



你觉得它们是互相排斥的。他们不是;同时使用两者。


>

有问题的图像位于< http://rjbox.net,大约在

页面。



你很接近;使用img {border-style:none; }。这将适用于

链接中的所有图像而不仅仅是您询问的图像,但

这就是这个特定页面指定的内容。


也许我也大胆提出一些其他评论?既然你已经造型了(而且你似乎非常关心好的XHTML),那么就可以获得额外的< brtags。首先,它们不是XHTML

:你需要关闭所有元素,这里使用< br />。第二,

你不需要它们,它们既没有语义正确也没有灵活的b
。如果要修改元素的间距,请使用边距

(或填充)样式。例如,p {margin-bottom:2em;}。


当然,你必须添加实际的< ptags。好像你没有

真的标记了你的代码。大部分文字是一个很长的DIV:

< div class =" justify">。交换为< p>,添加< pand< / ptags到

删除段落(这就是他们的用途),并设置< pwith
align:justify(我更喜欢对齐:左边因为对齐可能难以阅读,

但是你选择。如果你改变主意,你可以快速改变它。) >
地方,.css文件)。


您的元素的CSS规则应该在订单中

link-visited-hover-活跃,否则级联不会以你可能期望的方式计算出来。 (Google为Las Vegas Has Animals......)


在所有图片上,您可以应用ID然后设置尺寸样式。

替换height =" 37"宽度= QUOT; 90"使用CSS:

#vimimg {身高:37px;宽度:90像素; }


此外,您可以重新考虑您的替代内容。标题是可以的(建立

与Vim),但对于alt属性,我会添加类似Vim logo

的东西,因为,好吧,这就是形象。无论如何,我肯定会把b
除掉alt文本中的额外空格;我不知道屏幕如何对读者做出反应。


你的< title>中有一堆& nbsp。你有什么突破性的b / b
如果没有它们,标题会受到影响吗?在任何情况下,我相信& nbsp;

无效的XHTML。检查W3C文档。


您的元标记也不像XHTML所要求的那样自我关闭。


您将为所有人服务用户代理如Content-Type:text / html。


我比以往任何时候都更加确信你应该用一个替换你的doctype

对于HTML 4.01严格,验证它,并放松。


HTH。 GL!

-

John


Scripsit John Hosking:


你很亲密;使用img {border-style:none; }



是吗?在你对页面进行分析之后,我不愿意看一下,

所以我不知道这个CSS构造是否有任何接近。


无论如何,它并不真正满足请求我想确保没有

边框(围绕特定的小型博客按钮图像)出现在FF或

IE或任何其他浏览器中。肯定是一个用户样式表,如

img {border-style:solid!important; }

(或等效的浏览器设置)击败作者风格的规则

表。


当然,请求完全是愚蠢的,因为使用

按钮式图像而不是文本中的链接的想法。顺便说一句,当

成功时,删除边框也会删除访问和未访问(以及悬停和活动)链接之间的本质区别




-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/


< blockquote> John Hosking< Jo ** @ DELETE.Hosking.name.INVALIDwrites:


此外,您可以重新考虑您的替代内容。标题是可以的(建立

与Vim),但对于alt属性,我会添加类似Vim logo

的东西,因为,好吧,这就是形象。



我完全不同意 - 如果图像的目的(当可见时)

是说文档是用Vim,然后alt文本

应该是内置Vim。


如果图像的目的是显示Vim徽标的样子,

然后是Vim logo可能没问题,但是The Vim logo是

[描述]可能会更好。


我认为alt文本的一般最佳规则是考虑如果有人删除了所有文本

你会*放在那里你的图片文件夹

你希望页面仍然对读者有意义,同时从备份中检索图像




-

Chris


I want to make sure that no border (around a specific small "blog-button"
image) ever appears in FF or IE, or any other browswer. I couldn''t seem do
it with xhtml, so I reverted to

border="0"

inside the "img" tag. This of course does not validate as xhtml. it does
what I want it to do (gets rid of the border, in both browsers), but I want
all my code to be validated, well-formed xhtml.

How might I do this correctly using either xhtml or css?

The image in question is at <http://rjbox.net, about halfway down the
page.

The code in question is here:

99 Should you happen to agree with this you&rsquo;ll appreciate the
100 philosophy over at <a href="http://no-www.org"><img
101 src="http://no-www.org/images/blog-button.gif"
102 alt=" No-www.org "
103 title=" No-www.org "
104 border="0" /></a: “Succinctly, use of the www subdomain is
105 redundant and time consuming to communicate. The internet, media, and
106 society are all better off without it.”&nbsp;<br /><br />

--
// rj@panix.com //

解决方案

Russell Hoover wrote:

I want to make sure that no border (around a specific small "blog-button"
image) ever appears in FF or IE, or any other browswer. I couldn''t seem do
it with xhtml, so I reverted to

border="0"

inside the "img" tag. This of course does not validate as xhtml.

It doesn''t validate as HTML 4.01 strict either.

it does
what I want it to do (gets rid of the border, in both browsers), but I want
all my code to be validated, well-formed xhtml.

When people say that here, someone invariably comes along and asks /why/
you want that. Usually the poster doesn''t know, or thinks they know
(they want the most current code). Be aware (perhaps you already are)
that XHTML is not all it''s cracked up (or talked up) to be. Chances are,
you really ought to be using HTML 4.01 Strict. Especially since... well,
see my comments below.

>
How might I do this correctly using either xhtml or css?

You make it sound like they''re mutually exclusive. They''re not; use both.

>
The image in question is at <http://rjbox.net, about halfway down the
page.

You were close; use a img { border-style: none; } . This will apply to
all the images in links rather than just the one you asked about, but
that''s what this particular page specifies anyway.

Maybe I also be so bold as to offer a few other comments? Since you''re
already styling (and you seem to care so much about "good XHTML"), get
rid of the extra <brtags everywhere. First of all, they are not XHTML
either: you need to close all elements, here with <br/>. Second of all,
you don''t need them and they are neither semantically correct nor
flexible. Where you want to modify spacing for an element, use a margin
(or padding) style. E.g., p {margin-bottom: 2em;}.

Of course, you''ll then have to add actual <ptags. Seems you haven''t
really marked up your code at all. Most of the text is a big long DIV:
<div class="justify">. Trade that in for a <p>, add <pand </ptags to
deliminate paragraphs (that''s what they''re for), and style the <pwith
align:justify (I prefer align:left because justify can be hard to read,
but you choose. If you change your mind you can change it quickly in one
place, the .css file).

Your CSS rules for a elements should be in the order
link-visited-hover-active, otherwise the cascading won''t work out the
way you probably expect. (Google for "Las Vegas Has Animals" ...)

On all your images, you can apply an id and then style the dimensions.
Replace height="37" width="90" with CSS:
#vimimg { height:37px; width:90px; }

Also, you might rethink your alt content. The titles are okay ("Built
with Vim"), but for an alt attribute I''d put something like "Vim logo"
because, well, that''s what the image is. In any case, I would definitely
get rid of the extra spaces in the alt texts; I don''t know how screen
readers react to them.

You have a bunch of &nbsp in your <title>. What line-breaking do you
expect the title to suffer without them? In any case, I believe &nbsp;
is not valid XHTML. Check the W3C docs.

Your meta tags are not self-closed as XHTML requires, either.

You''re serving to all user-agents as Content-Type: text/html.

I''m more convinced than ever that you ought to just replace your doctype
with one for HTML 4.01 strict, validate it, and relax.

HTH. GL!
--
John


Scripsit John Hosking:

You were close; use a img { border-style: none; }

Was he? After your analysis of the page, I''m reluctant to take any look at,
so I can''t tell whether there''s anything close to this CSS construct there.

Anyway, it does not really satisfy the request "I want to make sure that no
border (around a specific small "blog-button" image) ever appears in FF or
IE, or any other browswer." Surely a user style sheet like
a img { border-style: solid !important; }
(or an equivalent browser setting) beats the rule in the author''s style
sheet.

Of course, the request was utterly foolish, as is the idea of using a
button-like image instead of a link inside text. By the way, when
"successful", removing the border also removes the essential distinction
between visited and unvisited (and hovered and active) links.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


John Hosking <Jo**@DELETE.Hosking.name.INVALIDwrites:

Also, you might rethink your alt content. The titles are okay ("Built
with Vim"), but for an alt attribute I''d put something like "Vim logo"
because, well, that''s what the image is.

I''d completely disagree - if the purpose of the image (when visible)
is to say that the document is built with Vim, then the alt text
should be "Built with Vim".

If the purpose of the image is to show what the Vim logo looks like,
then "Vim logo" might be okay, though "The Vim logo is
[description]" would probably be better.

I think the general best rule for alt text is to consider what text
you *would* place there if someone had deleted all your image folders
and you wanted the page to still make sense to readers while the image
was retrieved from backups.

--
Chris


这篇关于想删除img-border w / xhtml,而不是html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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