これは私ができる最善のことです。唯一の制限は、テキストが 1 行しかないことです。ただし、これをかなり簡単に変換して、画像の幅の 80% の div を内部に生成し、その div を中央に配置して段落テキストを許可するなど、いくつかの異なることを行うことができます。
下部の JSBin の例。
CSS
.vpbutton {
padding:4px;
background-color:#EFEFEF;
}
.userbox img{
padding:8px;
background-color:#EFEFEF;
border:1px solid #e5e5e5;
}
.userbox img:hover{
opacity:.2;
}
.hover-text {
display:none;
position:absolute;
}
.userbox img:hover ~ .hover-text {
border:1px solid #000;
top:0;
left:0;
display: block;
text-align:center;
}
JS
$(function() {
$('img[rel="hover-text"]').each(function () {
this$ = $(this)
console.log((this$.outerWidth() - this$.innerWidth()))
this$.parent().find('.hover-text').css({
'margin': (this$.outerWidth(true) - this$.width())+'px',
'top':0,
'left':0,
'height': (this$.height())+'px',
'width': (this$.width())+'px',
'line-height':(this$.height())+'px'
})
})
})()
HTML
<div class="userbox">
<img src='http://www.clonescriptsdb.com/scriptimages/inout-search-engine-google-like-search-engine-788.jpg' rel="hover-text">
<div class="hover-text">asd</div>
</div>
http://jsbin.com/azuyol/13/edit
マージン/パディング/ボーダーを正しく考慮するように更新します。