找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 524|回复: 1

子鼠相册效果V2.0___DIV+CSS

[复制链接]
发表于 2009-5-20 02:29:39 | 显示全部楼层 |阅读模式 IP:江苏南通
子鼠相册效果V2.0___DIV+CSS
曾经(大约一年前)用CSS作了一个相册的效果。

链接如下:http://www.zishu.cn/blogview.asp?logID=459

上边的效果是鼠标经过时才会显示大图,但是看起来不是很方便,也不合用户浏览习惯,但那时能作到的效果只能那样了,没有想出更好的办法。

昨天,我在弄《IE中锚点失效的解决办法 》时突然想到了这个相册的效果。想到了利用锚点还可以改进。

于是,就有了下边的效果:



CSS代码如下:

lt;style&gt;<br />
body{ margin:0; padding:0; font-size:12px; background: #333333; line-height:1.7; font-family:Verdana, quot;宋体&quot;; overflow:hidden }<br />
#info{ width:600px; background: #666666; margin-left:auto; margin-right:auto; text-align:center; border:1px solid #FFFFFF; height:400px; margin-top:20px;}<br />
h3{ margin:20px 0 0 0; color:#CC0000; font-size:12px;color:#FFF}<br />
ul,li{ list-style:none; margin:0; padding:0;}<br />
a:active,a:hover{ cursor:pointer}<br />
#info #zs img{ width:400px; height:280px; border:7px solid #FFF;}<br />
#zs{ height:360px; overflow: hidden; text-align:left; float:left; width:450px; margin-top:20px}<br />
#zs ul{ margin:0 0 0 30px;}<br />
#zs span{ display:block}<br />
#zs a{ display:inline}<br />
#nav{ padding-right:10px;width:135px; height:350px; overflow:auto; padding:0; text-align:left; float:left;}<br />
#nav a{ display:block}<br />
.z{ width:80px; height:56px;display:block; border:1px solid #FFFFFF; margin:4px 0 4px 25px;color:#FFF}<br />
.b1{ background:url(http://www.zishu.cn/images/b1.jpg)}<br />
.b2{ background:url(http://www.zishu.cn/images/b2.jpg)}<br />
.b3{ background:url(http://www.zishu.cn/images/b3.jpg)}<br />
.b4{ background:url(http://www.zishu.cn/images/b4.jpg)}<br />
.b5{ background:url(http://www.zishu.cn/images/b5.jpg)}<br />
.b6{ background:url(http://www.zishu.cn/images/b6.jpg)}<br />
#zs li{ display:block; height:400px;}<br />
lt;/style&gt;
复制代码

BODY部分:

lt;div id=&quot;info&quot;&gt;<br />
nbsp;&nbsp;&lt;h3&gt;子鼠的CSS相册v2.0&lt;/h3&gt;<br />

nbsp;&nbsp;&lt;div id=&quot;zs&quot;&gt;&nbsp;&nbsp;<br />
nbsp; &nbsp; &lt;ul&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z1&quot; id=&quot;z1&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a1.jpg&quot; alt=&quot;照片1&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片1<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z2&quot; id=&quot;z2&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a2.jpg&quot; alt=&quot;照片2&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片2<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z3&quot; id=&quot;z3&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a3.jpg&quot; alt=&quot;照片3&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片3<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z4&quot; id=&quot;z4&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a4.jpg&quot; alt=&quot;照片4&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片4<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z5&quot; id=&quot;z5&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a5.jpg&quot; alt=&quot;照片5&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片5<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z6&quot; id=&quot;z6&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a6.jpg&quot; alt=&quot;照片6&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片6<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z7&quot; id=&quot;z7&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a1.jpg&quot; alt=&quot;照片1&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片1<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&lt;li&gt;&lt;a name=&quot;z8&quot; id=&quot;z8&quot;&gt;&lt;/a&gt;&lt;img src=&quot;http://www.zishu.cn/images/a2.jpg&quot; alt=&quot;照片2&quot; /&gt;&lt;br /&gt;<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;这是照片2<br />
nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;span&gt;&lt;a href=&quot;http://www.zishu.cn&quot; target=&quot;_blank&quot;&gt;www.zishu.cn&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;<br />
nbsp; &nbsp; &lt;/ul&gt;<br />
nbsp;&nbsp;&lt;/div&gt;<br />
nbsp;&nbsp;<br />
nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;nav&quot;&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z1&quot; class=&quot;b1 z&quot; title=&quot;照片1&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z2&quot; class=&quot;b2 z&quot; title=&quot;照片2&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z3&quot; class=&quot;b3 z&quot; title=&quot;照片3&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z4&quot; class=&quot;b4 z&quot; title=&quot;照片4&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z5&quot; class=&quot;b5 z&quot; title=&quot;照片5&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z6&quot; class=&quot;b6 z&quot; title=&quot;照片6&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z7&quot; class=&quot;b1 z&quot; title=&quot;照片1&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&lt;a href=&quot;#z8&quot; class=&quot;b2 z&quot; title=&quot;照片2&quot;&gt;&lt;/a&gt;<br />
nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
lt;/div&gt;
复制代码


效果如下:


<!DOCTYPE <span href="tag.php?name=html" onclick="tagshow(event)" class="t_tag">html</span> PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>子鼠的CSS相册v2.0</title><br />
<style><br />
body{ margin:0; padding:0; font-size:12px; background: #333333; line-height:1.7; font-family:Verdana, "宋体"; overflow:hidden }<br />
#info{ width:600px; background: #666666; margin-left:auto; margin-right:auto; text-align:center; border:1px solid #FFFFFF; height:400px; margin-top:20px;}<br />
h3{ margin:20px 0 0 0; color:#CC0000; font-size:12px;color:#FFF}<br />
ul,li{ list-style:none; margin:0; padding:0;}<br />
a:active,a:hover{ cursor:pointer}<br />
#info #zs img{ width:400px; height:280px; border:7px solid #FFF;}<br />
#zs{ height:360px; overflow: hidden; text-align:left; float:left; width:450px; margin-top:20px}<br />
#zs ul{ margin:0 0 0 30px;}<br />
#zs span{ display:block}<br />
#zs a{ display:inline}<br />
#nav{ padding-right:10px;width:135px; height:350px; overflow:auto; padding:0; text-align:left; float:left;}<br />
#nav a{ display:block}<br />
.z{ width:80px; height:56px;display:block; border:1px solid #FFFFFF; margin:4px 0 4px 25px;color:#FFF}<br />
.b1{ background:url(http://www.zishu.cn/images/b1.jpg)}<br />
.b2{ background:url(http://www.zishu.cn/images/b2.jpg)}<br />
.b3{ background:url(http://www.zishu.cn/images/b3.jpg)}<br />
.b4{ background:url(http://www.zishu.cn/images/b4.jpg)}<br />
.b5{ background:url(http://www.zishu.cn/images/b5.jpg)}<br />
.b6{ background:url(http://www.zishu.cn/images/b6.jpg)}<br />
#zs li{ display:block; height:400px;}<br />
</style><br />
</head><br />
<body><br />
<div id="info"><br />
  <h3>子鼠的CSS相册v2.0</h3><br />
  <div id="zs"><br />
  <br />
    <ul><br />
      <li><a name="z1" id="z1"></a><img src="http://www.zishu.cn/images/a1.jpg" alt="照片1" /><br /><br />
        这是照片1<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z2" id="z2"></a><img src="http://www.zishu.cn/images/a2.jpg" alt="照片2" /><br /><br />
        这是照片2<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z3" id="z3"></a><img src="http://www.zishu.cn/images/a3.jpg" alt="照片3" /><br /><br />
        这是照片3<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z4" id="z4"></a><img src="http://www.zishu.cn/images/a4.jpg" alt="照片4" /><br /><br />
        这是照片4<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z5" id="z5"></a><img src="http://www.zishu.cn/images/a5.jpg" alt="照片5" /><br /><br />
        这是照片5<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z6" id="z6"></a><img src="http://www.zishu.cn/images/a6.jpg" alt="照片6" /><br /><br />
        这是照片6<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z7" id="z7"></a><img src="http://www.zishu.cn/images/a1.jpg" alt="照片1" /><br /><br />
        这是照片1<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
      <li><a name="z8" id="z8"></a><img src="http://www.zishu.cn/images/a2.jpg" alt="照片2" /><br /><br />
        这是照片2<br />
        <span><a href="http://www.zishu.cn" target="_blank">www.zishu.cn</a></span></li><br />
    </ul><br />
  </div><br />
  <br />
        <div id="nav"><br />
          <a href="#z1" class="b1 z" title="照片1"></a><br />
          <a href="#z2" class="b2 z" title="照片2"></a><br />
          <a href="#z3" class="b3 z" title="照片3"></a><br />
          <a href="#z4" class="b4 z" title="照片4"></a><br />
          <a href="#z5" class="b5 z" title="照片5"></a><br />
          <a href="#z6" class="b6 z" title="照片6"></a><br />
          <a href="#z7" class="b1 z" title="照片1"></a><br />
          <a href="#z8" class="b2 z" title="照片2"></a><br />
        </div><br />
</div><br />
</body><br />
</html>
   提示:您可以先修改部分代码再运行



这个效果我在IE6和7中测试过了.

另外,由于这个例子中的代码是我从上一个相册中改的,所以代码和CSS不是最优的。有相当大的优化空间。

再另外,在现实中,我想也不会有人用这个东西来作相册,我想实现的只是CSS和HTML在一起到底能作什么。 玩呗! 挑战无处不在!

原贴:http://www.zishu.cn/blogview.asp?logID=599
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 13:19 , Processed in 0.224701 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表