大多数浏览器是否支持 fb:like 等标签的 CSS?

发布于 2024-10-29 02:20:48 字数 390 浏览 5 评论 0原文

大多数浏览器支持诸如

<fb:like ... >    </fb:like>

(Facebook XFBML 标签)之类的标签。 namespace:tagname 实际上是命名标签标准的一部分吗?

另外,CSS 支持怎么样?我很少直接设计它的样式

fb:like { font-size: 11px }

,但对于有经验的人来说,它可以与大多数现代浏览器一起使用吗? (IE 6 也是如此?)是否有任何情况下它不起作用甚至使浏览器崩溃?可能某些移动浏览器没有足够的能力来处理这个问题。

Most browsers support tags such as

<fb:like ... >    </fb:like>

(which is a Facebook XFBML tag). Is the namespace:tagname actually part of the standard of naming tags?

Also, how about CSS support? Seldom do I directly style it like

fb:like { font-size: 11px }

but for people who are experienced with it, does it work with most modern browsers? (IE 6 too?) Is there any case where it doesn't work or even crash a browser? Probably some of the mobile browsers are not so well equipped to handle this.

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

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

发布评论

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

评论(5

手心的温暖 2024-11-05 02:20:48

浏览器对命名空间:标签名形式的标签的处理在 IE 中与其他浏览器有很大不同,并且绝对不是标准化的。然而,在您的特定情况下,元素的样式似乎非常简单。使用:

fb\:like { font-size: 11px }

已在 IE6、IE7、Firefox 3.6 和 Chrome 10 中测试并运行。

Browser handling for tags of the form namespace:tagname is very different in IE to other browsers and is definitely not standardized. However, it seems that in your particular case styling of the element is quite straightforward. Use:

fb\:like { font-size: 11px }

Tested and working in IE6, IE7, Firefox 3.6 and Chrome 10.

审判长 2024-11-05 02:20:48

namespace:tagname 实际上是命名标签标准的一部分吗?

是的。 namespace:type 语法在 XML 1.0 中定义语法,因此被 XHTML 和 XFBML 等语言采用。

另外,CSS 支持怎么样?

CSS3 选择器的命名空间运算符是 |,定义于 规格

举个简单的例子,人们可能会这样设计它:

@namespace fb url(http://www.facebook.com/2008/fbml);
fb|like { font-size: 11px; }

: 象征着伪类(以及 CSS2 中的伪元素),而 fb:like 显然不是。

请注意,这在 IE < 中不起作用。 9,它无法识别 XML 序列化页面,因此不会在 CSS 中实现名称空间。如果您想要更好的浏览器支持,可以将 : 视为元素名称的一部分,并使用 fb\:like 作为选择器,正如阿洛奇所说

Is the namespace:tagname actually part of the standard of naming tags?

Yes. The namespace:type syntax is defined in the XML 1.0 grammar, and as such is adopted by languages like XHTML and XFBML.

Also, how about CSS support?

The namespace operator for CSS3 selectors is |, defined in this spec.

So as a quick example, one might style it like this:

@namespace fb url(http://www.facebook.com/2008/fbml);
fb|like { font-size: 11px; }

: symbolizes pseudo-class (and pseudo-element in CSS2), which clearly fb:like isn't.

Note that this will not work in IE < 9, which doesn't recognize XML-serialized pages and consequently don't implement namespaces in CSS. If you want better browser support you can treat : as part of the element name and use fb\:like as the selector, as Alohci says.

原来是傀儡 2024-11-05 02:20:48

大多数页面支持fb:like标签...它们需要一个iframe来从Facebook加载支持页面,该页面确实包含所需的元标记、命名空间等来理解它...

...或者他们要求开发人员包含这些元标记以及必要的 xfbml 链接,以使他们的页面解析此名称空间。

命名空间很好,并且对于解析 ML 很有意义。所有 HTML 实际上都是带有命名空间的 ML。 Facebook 希望您包含他们的命名空间。但是,他们知道您可能不太愿意这样做,因此要求您包含 javascript 来解决这些“命名空间”问题并仅解析相应的标签。感谢 Facebook 解决了这个问题。

现在您对设置这些标签的样式感兴趣。大多数浏览器将未知的命名空间视为“display: inline”。您可以对其应用“样式属性”,但它们不会被识别。您要么必须遵循 Facebook 的规则来设计这些 fb:like 标签(即他们的 javascript 愿意将其解析为可接受的属性 - 您可以发现 此处)。最好做什么?要么用“div”包装这个 fb:like 并设置 div 的样式以用于定位目的,要么使用 Facebook 定义的属性来进行 javascript 解析 ML。

未来浏览器会支持 Facebook 命名空间吗?好吧,考虑到 HTML5 最终被识别花了多长时间,可能不会。要么 Facebook 会创建自己的浏览器(谁知道呢,即使 Google 在 6 次迭代/2 年内创建了 Chrome,如果不是出于各种其他原因,就渗透率而言,它甚至可以与 IE6 / 7 相媲美)。

或者 Facebook 可能被认为是未来浏览器中一个完全有价值的命名空间...值得怀疑,但是嘿,考虑一下 FB / TW 是随处使用的图标(包括星际争霸 2!)。所以你知道...还有希望。

与此同时,在他们的系统内工作。

Most pages don't support fb:like tags... They require either an iframe which loads a supporting page from Facebook that does include the required meta tags, namespace, etc. to understand it...

...or they ask the developer to include these meta tags as well as the necessary xfbml links to make their pages parse this namespace.

Namespaces are good and make sense parsing ML. All HTML is really ML with a namespace. Facebook wants you to include their namespace. However, they understand you might not be so willing to, so ask you to instead include javascript to work around these "namespace" issues and just parse the respective tags. Kudos to Facebook for working around this.

Now you're interested in styling these tags. Most browsers consider unknown namespaces as a "display: inline". You can apply "style attributes" to it, but they wont be recognized. You'll either have to follow Facebook's rules for styling these fb:like tags (i.e. what their javascript is willing to parse as an acceptable attribute - you can find that here). Best thing to do? Either wrap this fb:like with a "div" and style that div for positioning purposes, or work with Facebook's defined attributes for their javascript-parsing ML.

Will browsers support the Facebook namespace in the future? Well, considering how long it took for HTML5 to FINALLY be recognized, probably not. Either Facebook will create their own browser (and who knows, even Google created Chrome in 6 iterations / 2 years, and it rivals if not BEATS IE6 / 7 in terms of penetration rates if not all sorts of other reasons).

Or Facebook may be considered a perfectly worthy namespace in future browsers... Doubtful but hey, consider FB / TW are icons used EVERYWHERE (including Starcraft 2!). So ya know... there's hope.

In the meantime, work within their system.

谎言月老 2024-11-05 02:20:48

虽然这是一篇旧文章,但我认为值得注意的是 Facebook 在其 XHP 扩展中使用了 模式。 XHP是Facebook自己的PHP扩展,它使得PHP能够将XML节点解释为PHP对象,本质上是对XML节点的转换到简单的 HTML 节点。

我们自己的 标签可能仍然由 javascript 处理,但我猜测 XHP 正在 API 端的某个地方使用。

While this is an old post, I think it is worth noting that the <namespace:tagname> pattern is something Facebook uses in their XHP extension. XHP is Facebooks own PHP extension, which make PHP able to interpret XML nodes as PHP objects, essentially transforming XML nodes to simple HTML nodes.

Our own <fb:like> tags are probably still handled by javascript, but I'm guessing XHP is being used somewhere on their end of the API.

忆梦 2024-11-05 02:20:48

像这样的标签仅存在于 XFBML 框架中(即您需要包含 Facebook JavaScript 库才能使它们工作)。

您所要求的方式没有 CSS 支持。

fb:like { font-size: 11px }

上面的 CSS 代码将不起作用。但是您可以按照标准方式将 CSS 类分配给该标签。

Tags like exist only within XFBML framework (i.e. you need to include Facebook JavaScript libraries to make them work)

There is no CSS support the way you are asking.

fb:like { font-size: 11px }

The CSS code above won't work. But you can assign CSS class to this tag the standard way.

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