相关疑难解决方法(0)

纯CSS:在悬停文本上方的中心工具提示

小提琴看看我到目前为止:http://jsbin.com/udegux/1/edit

HTML

<span id="test" class="drag-hint"><span>drag</span>Mouse and drag</span>
Run Code Online (Sandbox Code Playgroud)

CSS:

.drag-hint {
  position:relative;
}
.drag-hint > span{
  display:none;
}
.drag-hint:hover > span {
  display:inline;
  position:absolute;
  top: -25px;
  left: 30px;
}
Run Code Online (Sandbox Code Playgroud)

如您所见,我目前通过指定"顶部"和"左侧"属性手动将悬停拖动提示居中于文本上.如果文本更长或更短,我将不得不手动更改这些值以使提示看起来居中.

我正在寻找一种方法,使用纯CSS自动将"拖动"一词置于短语"鼠标并拖动"之上.

css

4
推荐指数
2
解决办法
7547
查看次数

标签 统计

css ×1