在做pj皮肤的时候到网上搜了个分页效果,因为颜色不搭就没用,但是个人认为挺漂亮。代码也够简洁。
下面是用的背景图片:
html代码:
<div id="pagebar">
<a href="#"><<</a>
<span>1</span>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#">7</a>
<a href="#">8</a>
<a href="#">9</a>
<a href="#">10</a>
<a href="#">11</a>
<a href="#">12</a>
<a href="#">13</a>
<a href="#">14</a>
<a href="#">15</a>
<a href="#">>></a>
</div>
css代码
* {
margin:0;
padding:0;
text-decoration:none;
}
#pagebar {
float:left;
display:inline;
width:570px;
height:32px;
margin:50px;
font-size:13px; }
#pagebar a,#pagebar .page_now {
display:block;
float:left;
margin-right:4px;
padding:2px 5px;
border:1px solid #f30;
color:#fff;
font-weight:800;
background:url(pagebar_bg.png) repeat-x 0 0 ;
}
#pagebar a {
display:inline;
}
#pagebar a:hover {
border:1px solid #03c;
background-position:0 -30px;
}
#pagebar .page_now {
border:1px solid #333;
background-image:none;
background:#666;
}
预览效果:
<!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=gb2312" /> <title>www.jb51.net - DIV CSS实例:橙蓝CSS翻页效果</title> <style type="text/css"> * { margin:0; padding:0; text-decoration:none;} #pagebar { float:left; display:inline; width:570px; height:32px; margin:50px; font-size:13px; } #pagebar a,#pagebar .page_now { display:block; float:left; margin-right:4px; padding:2px 5px; border:1px solid #f30; color:#fff; font-weight:800; background:url(http://www.jb51.net/do/uploads/userup/1006/061S14Y600.png) repeat-x 0 0 ;} #pagebar a { display:inline;} #pagebar a:hover { border:1px solid #03c; background-position:0 -30px;} #pagebar .page_now { border:1px solid #333; background-image:none; background:#666;} </style> </head> <body> <div id="pagebar"> <a href="http://www.jb51.net/"><<</a> <span>1</span> <a href="http://www.jb51.net/">2</a> <a href="http://www.jb51.net/">3</a> <a href="http://www.jb51.net/">4</a> <a href="http://www.jb51.net/">5</a> <a href="http://www.jb51.net/">6</a> <a href="http://www.jb51.net/">7</a> <a href="http://www.jb51.net/">8</a> <a href="http://www.jb51.net/">9</a> <a href="http://www.jb51.net/">10</a> <a href="http://www.jb51.net/">11</a> <a href="http://www.jb51.net/">12</a> <a href="http://www.jb51.net/">13</a> <a href="http://www.jb51.net/">14</a> <a href="http://www.jb51.net/">15</a> <a href="http://www.jb51.net/">>></a> </div> </body> </html>
提示:您可以先修改部分代码再运行