仅用css+HTML实现图片墙功能

本文介绍如何仅使用CSS和HTML技术实现一个图片墙功能。在Firefox或Chrome浏览器中,当鼠标悬停在图片上时,图片会链接到放大后的版本。这是一个纯前端的解决方案,不涉及JavaScript。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

备注:最好在firefox或chrome运行,在IE效果没出现  -。-

效果如下:

当鼠标移动到某一张图片时,另外也点击打开图片,会自动连接到大图片。

代码如下:

-----------NewFile.html--------

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="NewFile.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="photo-album">
    <h1><span>Angel <abbr title="and" class="amp">&</abbr> Girl in New Zealand</span></h1>        
    <a href="./images/1.jpg" class="large polaroid img1"><img src="./images/1_small.jpg" alt="" />This breathtaking volcanic lake is at Wai-O-Tapu Thermal Wonderland</a>
    <a href="./images/2.jpg" class="polaroid img2"><img src="./images/2_small.jpg" alt="" />This lovely waterfall was at Rotorua in Rainbow Springs</a>
    <a href="./images/3.jpg" class="small polaroid img3"><img src="./images/3_small.jpg" alt="" />Ferntastic</a>        
    <a href="./images/10.JPG" class="medium polaroid img4"><img src="./images/10_small.jpg" alt="" />At Kaikoura we went whale watching!</a>        
    <a href="./images/5.JPG" class="polaroid img5"><img src="./im
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值