链接 href 仅适用于 Chrome

发布于 2024-10-12 09:36:10 字数 1794 浏览 2 评论 0原文

我正在制作一个打开链接(网站)的按钮,但问题是它只适用于 chrome!为什么?? 链接在这里!

这里是简单的 html 代码>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
<title>HTML and CSS Rounded Corner Button Generated By iWebToolsOnline.com</title>
<link href="./style.css" rel="stylesheet" type="text/css" />
<style href>a {text-decoration: none} </style>
 </head>
  <body>
<h3>&nbsp;</h3>
<button class="rounded">
  <a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator">
  <span>Save</span>
  </a>
</button>
 <br/><br/>

 </body>
  </html>

CSS

button {
 border: 0 none;
 cursor: pointer;
 font-weight: bold;
 padding: 0 15px 0 0;
 text-align: center;
 height: 40px;
 line-height: 40px;
 width: auto;
 }

 button.rounded {
 background: transparent url( btn_right.png ) no-repeat scroll right top;
 clear: left;
 font-family: "Kristen ITC";
 font-size: 36px;

  }

  button span {
  display: block;
  padding: 0 0 0 15px;
  position: relative;
  white-space: nowrap;
  height: 40px;
  line-height: 40px;
   }

  button.rounded span {
  background: transparent url( btn_left.png ) no-repeat scroll left top;
  color: #FFFFFF;
  }

  button.rounded:hover {
  background-position: 100% -40px;
  }

  button.rounded:hover span {
  background-position: 0% -40px;
  }

  button::-moz-focus-inner {
  border: none;
  }

您可以在我尝试访问的链接中找到我用于按钮的生成器中的链接,生成器没有提供链接的代码,所以我只是在按钮中使用了 href,我这没有正确完成吗? 还有什么问题?

多谢!

Im making a button that opens a link (web site), but the problem is that it only works on chrome!! why??
link here!

here the simple html code>

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
<title>HTML and CSS Rounded Corner Button Generated By iWebToolsOnline.com</title>
<link href="./style.css" rel="stylesheet" type="text/css" />
<style href>a {text-decoration: none} </style>
 </head>
  <body>
<h3> </h3>
<button class="rounded">
  <a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator">
  <span>Save</span>
  </a>
</button>
 <br/><br/>

 </body>
  </html>

CSS

button {
 border: 0 none;
 cursor: pointer;
 font-weight: bold;
 padding: 0 15px 0 0;
 text-align: center;
 height: 40px;
 line-height: 40px;
 width: auto;
 }

 button.rounded {
 background: transparent url( btn_right.png ) no-repeat scroll right top;
 clear: left;
 font-family: "Kristen ITC";
 font-size: 36px;

  }

  button span {
  display: block;
  padding: 0 0 0 15px;
  position: relative;
  white-space: nowrap;
  height: 40px;
  line-height: 40px;
   }

  button.rounded span {
  background: transparent url( btn_left.png ) no-repeat scroll left top;
  color: #FFFFFF;
  }

  button.rounded:hover {
  background-position: 100% -40px;
  }

  button.rounded:hover span {
  background-position: 0% -40px;
  }

  button::-moz-focus-inner {
  border: none;
  }

You can find the link from the generator I used for the button in the link Im trying to go to, the generator doesn't give the code for the link so I just used href in the button, I this not done properly??
what else could be the problem?

Thanks a lot!

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

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

发布评论

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

评论(1

木格 2024-10-19 09:36:10

这样做:

  <a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator">
  <button class="rounded">Save</button>
  </a>

但这在 IE6 或 7 中不起作用(你需要用 JS(JQuery 示例)来模拟它):

$("a button").click(function() {
   window.location.href = $(this).parent().attr("href");
});

但在 Firefox 中它仍然会调用该页面两次(也许这对你来说并不重要)。有关于此的错误报告(https://bugzilla.mozilla.org/show_bug.cgi?id=577035)。

请记住,将“BUTTON”放在“A”内是违反 W3C 标准建议的。

Do it like this:

  <a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator">
  <button class="rounded">Save</button>
  </a>

But this wont work in IE6 or 7 (you will need to emulate it with JS (JQuery example)) :

$("a button").click(function() {
   window.location.href = $(this).parent().attr("href");
});

But still in Firefox it will call twice that page (maybe it won't matter you). There is bug report about that (https://bugzilla.mozilla.org/show_bug.cgi?id=577035).

Just remember that having "BUTTON" inside "A" is against W3C standard recommendations.

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