为什么JQuery UI滑块中的句柄是< a>标签? [英] Why the handle in JQuery UI slider is <a> tag?

查看:85
本文介绍了为什么JQuery UI滑块中的句柄是< a>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读官方演示页面中的滑块代码: http://jqueryui.com/demos/滑块/,我想知道为什么将<a>标记用于句柄?为什么不使用<div>?

I was reading the code in the official demo page for slider: http://jqueryui.com/demos/slider/ and I was wondering why an <a> tag is used for handle? Why not a <div>?

<div class="demo">

<div id="slider" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all">
    <a class="ui-slider-handle ui-state-default ui-corner-all ui-state-hover" href="#" style="left: 19%; ">
    </a>
</div>

</div>

推荐答案

我认为他们使用了锚点,因为在HTML链接中,HTML与其他标记语言是分开的,因为它们提供了交互.摘自w3c

I think they used an anchor because in HTML links are what separate HTML from other markup languages because they provide interaction. Taken from w3c

HTML为富文本格式提供了许多传统的发布习惯用法 和结构化文档,但它与大多数其他标记的区别是什么 语言是超文本和交互式文档的功能. 本节介绍链接(或超链接或Web链接), 基本的超文本构造.链接是来自一个网站的连接 资源到另一个.虽然是一个简单的概念,但链接一直是 推动Web成功的主要力量.

HTML offers many of the conventional publishing idioms for rich text and structured documents, but what separates it from most other markup languages is its features for hypertext and interactive documents. This section introduces the link (or hyperlink, or Web link), the basic hypertext construct. A link is a connection from one Web resource to another. Although a simple concept, the link has been one of the primary forces driving the success of the Web.

句柄也是您单击的内容,因此也许他们认为使用<a>而不是<span>在语义上更有意义.

And the handle is also something you click, so maybe they thought that semantically made more sense using an <a> instead of a <span>.

为了明确起见,我认为他们可以在技术上使用任何东西,但是出于语义原因选择锚点

To make it clear, my thought is that they could have used anything technically but they choose an anchor for semantic reasons

这篇关于为什么JQuery UI滑块中的句柄是&lt; a&gt;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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