使用 firebug 将替代文本添加到图像

发布于 2024-08-15 17:04:28 字数 39 浏览 2 评论 0原文

有人可以告诉我如何在 firebug 上的图像中添加替代文本吗?

Can somebody please tell me how to add alt text to images on firebug?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

虚拟世界 2024-08-22 17:04:28

您可以使用 Firebug 控制面板中的元素检查器(菜单左上角的第二个图标,Firebug 徽标图标旁边)。单击它,然后单击要编辑的图像。然后在右侧窗格中,选择 DOM 选项卡,并找到 alt 属性。双击值字段,然后输入您想要的替代值。

当然,您在 Firebug 中所做的任何更改都不是永久性的,并且会在您刷新页面时消失。您必须将它们复制到 HTML 中才能保存。

You can use the element inspector from the Firebug control panel (2nd icon from the top left of the menu, next to the firebug logo icon). Click on that, then on the image you want to edit. Then in the right-hand pane, select the DOM tab, and find the alt attribute. Double-click the value field, and enter the alt value you'd like.

Any changes you make in Firebug aren't permanent of course, and disappear when you refresh the page. You'll have to copy them into the HTML to save them.

网名女生简单气质 2024-08-22 17:04:28

使用 Firebug 检查图像,然后右键单击该元素并添加属性,该属性将允许您添加 alt 属性,即 alt 文本。但只是想知道你到底想要完成什么,因为你可以从萤火虫中节省工作。

Firebug 只是一个客户端编辑器,它不允许您将工作返回到您的站点上。当您乐意在正在查看的 HTML 文件中进行相同的更改时,您可以使用 Firebug 测试编辑。

在您的情况下,您需要查看购物车 html 并找到要编辑的 img 标签,然后在其中添加 alt 属性。

Inspect the image with Firebug then right click the element and do add attribute that will allow you to add an alt attribute which is the alt text. But just wondering what exactly are you trying to accomplish as you can save work out of firebug.

Firebug is only a client side editor it will not allow you to get work back onto your site. You can test edits just for you with firebug when you are happy make the same changes in the HTML file you are viewing.

In your case you will need to look at the shopping carts html and find the img tag you want to edit then add the alt attribute there.

橙味迷妹 2024-08-22 17:04:28

我回答你的评论,而不是你的主要问题,上面正确回答了,但对你的需要没有用...

在 Firefox 中,你不会像你看到的那样检查图像来获取它的 URL,而是选择属性:它将给出如果图像上有链接,请在图像属性下输入完整路径(就像我在本页顶部的 Stack Overflow 徽标上写的那样:我可以看到 http://sstatic.net/so/img/logo.png URL)。
除非图像是在 CSS 中定义的,即。作为背景,使其更难找到(Firebug 可以在这里提供帮助)。

此外,您的购物车页面可能是在模板中定义的(您没有告诉我们您使用什么软件)。例如,在 Zen Cart 中,您可以在 /includes/templates/template_default/info_shopping_cart/tpl_main_page.php 中找到一个文件,但也可以在 /includes/templates/<一些模板名称>/info_shopping_cart/tpl_main_page.php(如果您使用其他模板)。感兴趣的部分实际上可以位于主文件包含的另一个文件中,或者甚至,如果编码有点草率,则硬编码在某些 PHP(或其他语言)文件中......

在这种情况下,一旦您在 Firebug 中找到该图像,环顾四周:您的图像或它附近的某些标签是否有 ID?或者一些课程,例如。 class="横幅左侧"
使用一些递归 grep 工具搜索这样的 HTML 片段可以帮助找到要更改的文件。对于一些陷阱,因为例如类也可以生成(即,您可以在代码中找到类似: class="banner ")。

并按照自定义购物车的说明进行操作(如果有)。如果制作精良,它可以通过仅复制另一个文件夹下已更改的文件来创建自定义模板。如果可能的话,您必须避免修改开箱即用的文件,因为升级软件时它们可能会被覆盖。

HTH。

I answer to your comments, not to your main question, correctly answered above and not useful to your need...

In Firefox, you don't do Inspect image to get its URL, as you saw, but select Properties: it will give you full path, under Image Properties if there is a link on the image (like on the Stack Overflow logo at the top of this page as I write: I can see http://sstatic.net/so/img/logo.png URL).
Unless the image is defined in CSS, ie. as background, making it harder to find out (Firebug can help here).

Beside, your shopping cart page is probably defined in a template (you haven't told us what software you use). For example, in Zen Cart, you can find a file at <root of shop>/includes/templates/template_default/info_shopping_cart/tpl_main_page.php but it can be instead in <root of shop>/includes/templates/<some template name>/info_shopping_cart/tpl_main_page.php if you use another template. And the part of interest can actually been in another file which is included by the main file, or even, if coding is a bit sloppy, hard-coded in some PHP (or other language) file...

In this case, once you located the image in Firebug, look around: does your image, or some tag near it, have an ID? Or some class, eg. class="banner leftside"?
Searching a fragment of HTML like this with some recursive grep facility can help in locating the file to change. With some traps, since for example classes can be generated too (ie. you can find in the code something like: class="banner <?php echo $columnSide; ?>").

And follow the instructions on customizing your cart (if any). If well made, it offers to created a custom template by copying only the changed files under another folder. You must avoid, if possible, to modify the files provided out of the box, as they can be overwritten when upgrading the software.

HTH.

书间行客 2024-08-22 17:04:28

使用 firebug 查找购物卡代码中的特定内容。就像该图像附近的 id=class= 一样。

然后在您的项目中搜索此。这将为您提供应该放置 alt 的位置。

PS 如果您不确定选择哪个,请在此处粘贴您页面的一些上下文(因为从外部无法读取您提供的链接)。

PPS 要搜索多个文件,请点击“开始”->“搜索”->“搜索文件和文件夹”->“文件中的单词或短语”,然后选择您的项目的目录。

Using firebug find something specific in your shopping card code. Like an id=<something special> or class=<something special> near that image.

Then search for this <something special> in your project. That will give you the place where alt should be put.

PS If you're unsure which <something special> to choose, paste here some context of your page (because the link you gave isn't readable from outside).

PPS To search in a number of files, click 'Start'->'Search'->'For files and folders'->'A word or phrase in a file' and choose the directory of your project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文