相对定位和绝对定位

  作者:会飞的

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv=&q

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style>

body { padding:20px;}

a { color:#00f; text-decoration:none;}

a:hover { color:#f60; position:relative; top:1px; left:1px;}

#layout { width:600px; margin:0 auto; background:#eee; position:relative;}

#new { position:absolute; top:-15px; left:140px;}

</style>

</head>

<body>

<div id="layout">

  <div id="new"><img src="new.gif" /></div>

  这里是内容<a href="#">这里是链接</a>这里也是内容</div>

</body>

</html>


有用  |  无用

猜你喜欢