在 HTML 中為移動瀏覽器獲取工具提示
單擊帶有標題屬性的元素時,會附加帶有標題文字的子元素。我們來看一個例子 -
對於 HTML -
<p> The <span class="demo" title="this is underscore">underlined</span> character. </p>
jQuery -
$("span[title]").click(function () {
var $title = $(this).find(".title");
if (!$title.length) {
$(this).append('<span class="title">' + $(this).attr("title") + '</span>');
} else {
$title.remove();
}
});以下是 CSS -
.demo {
border-bottom: 2px dotted;
position: relative;
}
.demo .title {
position: absolute;
top: 15px;
background: gray;
padding: 5px;
left: 0;
white-space: nowrap;
}
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP