利用CSS制作脸书_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:27:25
Original
1118 people have browsed it

 

很多网站都支持图片上的头像框识别,鼠标在头像框处,会提示一些人物信息。

这次就利用CSS实现这样一个功能:

div处主要包括两部分,一部分是图片;另一部分是链接以及脸框

<div class="remote">    <img src="war.jpg"    style="max-width:90%"  style="max-width:90%" alt="I love warcraft"/>    <ul>        <li class="卡加斯"><a href="" title="卡加斯"><span class="hotspot"></span><span class="link">卡加斯</span></a></li>        <li class="黑手"><a href="" title="黑手"><span class="hotspot"></span><span class="link">黑手</span></a></li>        <li class="基尔罗格"><a href="" title="基尔罗格"><span class="hotspot"></span><span class="link">基尔罗格</span></a></li>        <li class="耐奥祖"><a href="" title="耐奥祖"><span class="hotspot"></span><span class="link">耐奥祖</span></a></li>        <li class="古尔丹"><a href="" title="古尔丹"><span class="hotspot"></span><span class="link">古尔丹</span></a></li>        <li class="格罗玛什"><a href="" title="格罗玛什"><span class="hotspot"></span><span class="link">格罗玛什</span></a></li>        <li class="杜隆坦"><a href="" title="杜隆坦"><span class="hotspot"></span><span class="link">杜隆坦</span></a></li>    </ul></div>
Copy after login

大致的方法就是手动把hotspot这个span定位到每个脸对应的位置,可以在F12控制台中调整。当鼠标悬浮在链接上时,就会显示这个框:

    .remote {        width: 900px;        height: 600px;        position: relative;    }    .remote ul {        margin: 0;        padding: 0;        list-style-type: none;    }    .remote a .hotspot{        position: absolute;        /*display: block;*/        width: 50px;        height: 60px;    }    .remote .卡加斯 a .hotspot {        top: 200px;          left: 165px;    }    .remote .黑手 a .hotspot {        top: 115px;          left: 205px;    }    .remote .基尔罗格 a .hotspot {        top: 210px;          left: 230px;    }    .remote .耐奥祖 a .hotspot {        top: 180px;          left: 575px;    }    .remote .古尔丹 a .hotspot {        top: 280px;          left: 645px;    }    .remote .格罗玛什 a .hotspot {        top: 160px;          left: 470px;    }    .remote .杜隆坦 a .hotspot {        top: 170px;          left: 345px;    }    .remote a .link {        position: absolute;        display: block;        width: 10em;        right: -11em;        cursor: pointer;    }    .remote .卡加斯 a .link {        top: 0;    }    .remote .黑手 a .link {        top: 1.2em;    }    .remote .基尔罗格 a .link {        top: 2.4em;    }    .remote .耐奥祖 a .link {        top: 3.6em;    }    .remote .古尔丹 a .link {        top: 4.8em;    }    .remote .格罗玛什 a .link {        top: 6em;    }    .remote .杜隆坦 a .link {        top: 7.2em;    }    .remote a:hover .hotspot,    .remote a:focus .hotspot{        border: 1px solid #fff;    }    .remote a:hover .link,    .remote a:focus .link{        color:#0066FF;    }
Copy after login

查看视频观察效果!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!