使用css-overflow属性控制大小缩略图
2009-06-30 02:19:00 来源:WEB开发网纯CSS控制 ,没用javascript. 值得学习.
<!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=gbk" />
<title>Create Resizing Thumbnails With Overflow PRoperty</title>
</meta>
<style>
/* general */
body {
margin:0;
padding:40px 80px;
background:#fff;
font:70% Arial, Helvetica, sans-serif;
color:#555;
line-height:180%;
}
h1, h2{
font-size:180%;
font-weight:normal;
color:#555;
}
h2{
font-size:140%;
}
p{
margin:1em 0;
}
p.text{
width:500px;
}
a{
color:#f20;
text-decoration:none;
}
a:hover{
color:#999;
}
img{
border:none;
}
/* // general */
http://www.cncms.com/
/* thumbnail list */
ul#thumbs, ul#thumbs li{
margin:0;
padding:0;
list-style:none;
}
ul#thumbs li{
float:left;
margin-right:5px;
border:1px solid #999;
padding:2px;
}
ul#thumbs a{
display:block;
float:left;
width:100px;
height:100px;
line-height:100px;
overflow:hidden;
position:relative;
z-index:1;
}
ul#thumbs a img{
float:left;
position:absolute;
top:-20px;
left:-50px;
}
/* mouse over */
ul#thumbs a:hover{
overflow:visible;
z-index:1000;
border:none;
}
ul#thumbs a:hover img{
border:1px solid #999;
background:#fff;
padding:2px;
}
/* // mouse over */
/* clearing floats */
ul#thumbs:after, li#thumbs:after{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
ul#thumbs, li#thumbs{
display:block;
}
/* \*/
ul#thumbs, li#thumbs{
min-height:1%;
}
* html ul#thumbs, * html li#thumbs{
height:1%;
}
/* // clearing floats */
/* // thumbnail list */
/* single thumbnail */
p.thumb{
float:left;
margin:.5em 0;
margin-right:10px;
border:1px solid #999;
padding:2px;
}
p.thumb a{
display:block;
float:left;
width:100px;
height:100px;
line-height:100px;
overflow:hidden;
position:relative;
z-index:1;
}
p.thumb a img{
float:left;
position:absolute;
top:-20px;
left:-50px;
}
/* mouse over */
p.thumb a:hover{
overflow:visible;
z-index:1000;
border:none;
}
p.thumb a:hover img{
border:1px solid #999;
background:#fff;
padding:2px;
}
/* // mouse over */
/* // single thumbnail */
</style>
</head>
<body>
<h1>使用overflow属性控制大小缩略图</h1>
<h2>缩略图列表</h2>
<ul id="thumbs">
<li><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193532104.gif" /></a></li>
<li><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193532318.jpg" /></a></li>
<li><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193533156.jpg" /></a></li>
<li><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193533306.jpg" /></a></li>
<li><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193533910.jpg" /></a></li>
</ul>
<h2>单个缩略图</h2>
<p class="thumb"><a href="http://www.cssrain.cn"><img src="http://tech.cncms.com/tech/UploadPic/2010910/2010910193532318.jpg" /></a></p>
<p class="text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce nec pede. Vivamus euismod, odio eu sagittis tempor, ligula felis congue nunc, sit amet imperdiet mi nulla sed quam. In pulvinar bibendum urna. Nulla massa. Proin vulputate ornare risus. Nunc vel augue. Quisque vel magna. Cras tristique dignissim libero. Curabitur sagittis nibh eget arcu euismod blandit. Phasellus rhoncus. Proin congue risus sed dui.<br />
Mauris non metus. Donec sem ligula, feugiat a, porta quis, sagittis ut, elit. Nulla pellentesque justo. Morbi feugiat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed eros lorem, dapibus eget, varius in, hendrerit id, tortor. Fusce gravida arcu non lorem. Suspendisse nibh. Morbi et arcu. Vestibulum sodales interdum massa. </p>
<p>create by <a href="Css'>http://www.cssglobe.com/post/1305/create-resizing-thumbnails-using-overflow-property">Css Globe</a>
<a href="cssrainhttp://www.cssrain.cn">cssrain</a>整理</p>
</body>
</html>
- ››使用脚本恢复WinXP系统的用户登录密码
- ››使用phpMyadmin创建数据库及独立数据库帐号
- ››使用Zend Framework框架中的Zend_Mail模块发送邮件...
- ››使用cout标准输出如何控制小数点后位数
- ››使用nofollow标签做SEO的技巧
- ››使用 WebSphere Message Broker 的 WebSphere Tra...
- ››css特性:空白外边距互相叠加
- ››CSS技巧之圆角背景与三角形
- ››使用SQL Server事件探查器做应用程序的性能分析
- ››使用SQL Server事件探查器分析死锁原因
- ››使用纯文本文件打造WCF服务
- ››使用 Dojo 开发定制 Business Space 小部件,第 4...
更多精彩
赞助商链接