Move the mouse over the image to display the layer that follows the mouse

Source: Internet
Author: User
Tags relative
Tip: you can modify some code before running

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><ptml xmlns="http://www.w3.org/1999/xhtml"><pead><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Relative positioning and absolute positioning examples-author: Tang Guohui</title><style type="text/css"><!--*{margin:0px;padding:0px;}body {margin:10px;font-size: 13px;}a:link {color: #666;text-decoration: none;/*去除链接下划线*/}a:visited {color: #666;text-decoration: none;}a:hover {color: #F90;}h3 {color: #FFF;background-color: #F90;width: 100px;padding-top:3px;text-align:center;}ul {width: 300px;border-top: 1px solid #F60;/*使其上边有一线条,与标题h3吻合*/}ul li {padding:5px;border-bottom: 1px solid #CCC;list-style:none;/*去除列表样式,这对于标准浏览很重要*/}a {position: relative;/*设置其定位方法为相对定位,等一下内部信息面板就可以相对它定位*/display:block;/*让链接以块状呈现,这样不用点中链接文字就可以响应链接*/}a div {display: none;/*初始化信息面板不显示*/}a:hover {background:#fff;}/*IE7以下版本A状态伪类bug*/a:hover div {position: absolute;padding:5px;display:block;width: 245px;/*只给出宽度,高让它随内容多少自动调整*/left:150px;/*这是相对父级A的定位*/top: 20px;border: 1px solid rgb(91,185,233);background-color: rgb(228,246,255);z-index:999;/*把信息面板提到一个较高的位置,使链接文字过长时不会与面板重叠,但这只对FF有效*/}a img {width:80px;height:80px;border:none;/*去除图片边框,默认情况下,链接内的图片在标准浏览器会出现边框*/display:block;position: absolute;/*用绝对定位抽离正常文本流,不然在设计的时候考虑到不同浏览器正常显示会更麻烦*/top:5px;/*这里的5px是与信息面板大盒子的填充一样的*/left:5px;}dl {width: 160px;float:right;color: #999;line-height:20px;}dl dd span {font-weight: bold;color: #639;}--></style></pead><body><p>Latest single</p><ul><li>01 Huang Shengyi<div><dl><dd>Song name: Love's body</dd><dd>Singer: Huang Shengyi</dd><dd>Introduction: Huang Shengyi's main music album is indeed a true portrayal of her own heart. "Love's body" is composed by Hong Kong music master Jin Peida and prepared by Chen Shaoqi.</dd></dl></div></li><li>02 tired. Xin<div><dl><dd>Song name: Tired</dd><dd>Artist: Xin</dd><dd>Introduction: Youth Campus idol drama ----【
Tip: you can modify some code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.