王朝网络
分享
 
 
 

使用css-overflow属性控制大小缩略图

王朝学院·作者佚名  2009-06-30  
宽屏版  字体: |||超大  

纯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.knowsky.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://www.cssrain.cn/skins/tim/logo-jq.gif" /></a></li>

<li><a href="http://www.cssrain.cn"><img src="http://www.cssrain.cn/demo/pic/zhihuanbiao.jpg" /></a></li>

<li><a href="http://www.cssrain.cn"><img src="http://www.cssrain.cn/demo/pic/upan1.jpg" /></a></li>

<li><a href="http://www.cssrain.cn"><img src="http://www.cssrain.cn/demo/pic/skype3.jpg" /></a></li>

<li><a href="http://www.cssrain.cn"><img src="http://www.cssrain.cn/demo/pic/skype2.jpg" /></a></li>

</ul>

<h2>单个缩略图</h2>

<p class="thumb"><a href="http://www.cssrain.cn"><img src="http://www.cssrain.cn/demo/pic/zhihuanbiao.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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有