HTML5+CSS3+JS制作精美的宠物主题网站(内附源码,含5个页面)

一、作品简介

HTML5+CSS3+JS制作一个精美的宠物主题网站,包含首页、宠物出售页、宠物零食页、宠物饲养页、在线留言页等5个静态页面。其中每个页面都包含一个导航栏、一个主要区域和一个底部区域。

首页,包含吸引眼球的主要横幅、导航菜单、宠物出售模块以及宠物零食模块,以及宠物饲养模块。

二、首页结构

首页的页面结构包含:

  1. 固定在顶部的导航栏,包含logo和导航链接

  2. 轮播图展示区,使用Glide.js实现

  3. 精选宠物展示区,展示3个热门宠物

  4. 宠物零食展示区,展示4款热门零食

  5. 饲养指南区域,包含3个主要指导方向

  6. 页脚区域,包含联系方式等信息

三、作品演示

四、代码目录

五、代码演示

首页页面结构代码:

html 复制代码
<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>宠物主题网页 - 首页</title>
  <link type="text/css" href="css/family.css" rel="stylesheet" />
  <link type="text/css" href="css/all.min.css" rel="stylesheet" />
</head>

<body>
  <div class="water-mark water-mark-left">公众号【<span class="gzh-tips">木番薯科技</span>】,<span class="ym-tips">获取源码</span></div>
    <div class="water-mark water-mark-right">公众号【<span class="gzh-tips">木番薯科技</span>】,<span class="ym-tips">获取源码</span></div>
  <nav class="fixed top-0 left-0 right-0 bg-white shadow-md z-50">
    <div class="container mx-auto px-6 py-3">
      <div class="flex items-center justify-between">
        <div class="font-['Pacifico'] text-3xl text-custom">logo</div>
        <div class="hidden md:flex items-center space-x-8">
          <a href="./index.html" class="text-custom font-semibold">首页</a>
          <a href="./sell.html" class="text-gray-600 hover:text-custom">宠物出售</a>
          <a href="./pet-treats.html" class="text-gray-600 hover:text-custom">宠物零食</a>
          <a href="./feeding.html" class="text-gray-600 hover:text-custom">宠物饲养</a>
          <a href="./message.html" class="text-gray-600 hover:text-custom">在线留言</a>
        </div>
        <div class="relative">
          <input type="text" placeholder="搜索"
            class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:border-custom">
          <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
        </div>
      </div>
    </div>
  </nav>
  <div class="mt-16">
    <div class="glide">
      <div class="glide__track" data-glide-el="track">
        <ul class="glide__slides">
          <li class="glide__slide">
            <div class="relative h-[500px]">
              <img src="./images/b1.jpg" alt="宠物轮播图1" class="w-full h-full object-cover">
              <div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
                <div class="text-center text-white">
                  <h2 class="text-4xl font-bold mb-4">为您的家庭带来欢乐</h2>
                  <p class="text-xl mb-6">选择完美的宠物伙伴</p>
                  <button class="bg-custom text-white px-8 py-3 !rounded-button">立即购买</button>
                </div>
              </div>
            </div>
          </li>
          <li class="glide__slide">
            <div class="relative h-[500px]">
              <img src="./images/b2.jpg" alt="宠物轮播图2" class="w-full h-full object-cover">
              <div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
                <div class="text-center text-white">
                  <h2 class="text-4xl font-bold mb-4">为您的家庭带来欢乐</h2>
                  <p class="text-xl mb-6">选择完美的宠物伙伴</p>
                  <button class="bg-custom text-white px-8 py-3 !rounded-button">立即购买</button>
                </div>
              </div>
            </div>
          </li>
          <li class="glide__slide">
            <div class="relative h-[500px]">
              <img src="./images/b3.jpg" alt="宠物轮播图3" class="w-full h-full object-cover">
              <div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
                <div class="text-center text-white">
                  <h2 class="text-4xl font-bold mb-4">为您的家庭带来欢乐</h2>
                  <p class="text-xl mb-6">选择完美的宠物伙伴</p>
                  <button class="bg-custom text-white px-8 py-3 !rounded-button">立即购买</button>
                </div>
              </div>
            </div>
          </li>
        </ul>
      </div>
      <div class="glide__bullets" data-glide-el="controls[nav]">
        <button class="glide__bullet" data-glide-dir="=0"></button>
        <button class="glide__bullet" data-glide-dir="=1"></button>
        <button class="glide__bullet" data-glide-dir="=2"></button>
      </div>
    </div>

    <section class="container mx-auto px-6 py-12">
      <h2 class="text-3xl font-bold mb-8">热门宠物</h2>
      <div class="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-8">
        <div class="bg-white rounded-lg shadow-lg overflow-hidden">
          <img src="./images/rm1.jpg" alt="英短" class="w-full h-64 object-cover">
          <div class="p-6">
            <h3 class="text-xl font-semibold mb-2">英国短毛猫</h3>
            <p class="text-gray-600 mb-4">温顺可爱的英短,适合家庭饲养</p>
            <div class="flex justify-between items-center">
              <span class="text-custom text-xl font-bold">¥6,800</span>
              <button class="bg-custom text-white px-4 py-2 !rounded-button">查看详情</button>
            </div>
          </div>
        </div>
        <div class="bg-white rounded-lg shadow-lg overflow-hidden">
          <img src="./images/rm2.jpg" alt="金毛寻回犬" class="w-full h-64 object-cover">
          <div class="p-6">
            <h3 class="text-xl font-semibold mb-2">金毛寻回犬</h3>
            <p class="text-gray-600 mb-4">聪明温顺的金毛,最佳家庭伴侣</p>
            <div class="flex justify-between items-center">
              <span class="text-custom text-xl font-bold">¥4,500</span>
              <button class="bg-custom text-white px-4 py-2 !rounded-button">查看详情</button>
            </div>
          </div>
        </div>
        <div class="bg-white rounded-lg shadow-lg overflow-hidden">
          <img src="./images/rm3.jpg" alt="布偶猫" class="w-full h-64 object-cover">
          <div class="p-6">
            <h3 class="text-xl font-semibold mb-2">布偶猫</h3>
            <p class="text-gray-600 mb-4">优雅温柔的布偶猫,粘人的小棉袄</p>
            <div class="flex justify-between items-center">
              <span class="text-custom text-xl font-bold">¥8,500</span>
              <button class="bg-custom text-white px-4 py-2 !rounded-button">查看详情</button>
            </div>
          </div>
        </div>
        <div class="bg-white rounded-lg shadow-lg overflow-hidden">
          <img src="./images/rm4.jpg" alt="威尔士柯基" class="w-full h-64 object-cover">
          <div class="p-6">
            <h3 class="text-xl font-semibold mb-2">威尔士柯基</h3>
            <p class="text-gray-600 mb-4">活泼可爱的柯基,充满欢乐的小短腿</p>
            <div class="flex justify-between items-center">
              <span class="text-custom text-xl font-bold">¥7,200</span>
              <button class="bg-custom text-white px-4 py-2 !rounded-button">查看详情</button>
            </div>
          </div>
        </div>
      </div>
    </section>

    <section class="bg-gray-50 py-12">
      <div class="container mx-auto px-6">
        <h2 class="text-3xl font-bold mb-8">精选宠物零食</h2>
        <div class="flex overflow-x-auto space-x-6 pb-6">
          <div class="flex-none w-64">
            <div class="bg-white rounded-lg shadow-lg">
              <img src="./images/ls1.jpg" alt="宠物零食" class="w-full h-48 object-cover rounded-t-lg">
              <div class="p-4">
                <h3 class="font-semibold mb-2">天然鱼肉干</h3>
                <p class="text-custom font-bold mb-2">¥38.00</p>
                <button class="w-full bg-custom text-white py-2 !rounded-button">加入购物车</button>
              </div>
            </div>
          </div>
          <div class="flex-none w-64">
            <div class="bg-white rounded-lg shadow-lg">
              <img src="./images/ls2.jpg" alt="宠物零食" class="w-full h-48 object-cover rounded-t-lg">
              <div class="p-4">
                <h3 class="font-semibold mb-2">天然鱼干</h3>
                <p class="text-custom font-bold mb-2">¥39.90</p>
                <button class="w-full bg-custom text-white py-2 !rounded-button">加入购物车</button>
              </div>
            </div>
          </div>
          <div class="flex-none w-64">
            <div class="bg-white rounded-lg shadow-lg">
              <img src="./images/ls3.jpg" alt="宠物零食" class="w-full h-48 object-cover rounded-t-lg">
              <div class="p-4">
                <h3 class="font-semibold mb-2">营养饼干</h3>
                <p class="text-custom font-bold mb-2">¥45.90</p>
                <button class="w-full bg-custom text-white py-2 !rounded-button">加入购物车</button>
              </div>
            </div>
          </div>
          <div class="flex-none w-64">
            <div class="bg-white rounded-lg shadow-lg">
              <img src="./images/ls5.jpg" alt="宠物零食" class="w-full h-48 object-cover rounded-t-lg">
              <div class="p-4">
                <h3 class="font-semibold mb-2">有机狗狗饼干</h3>
                <p class="text-custom font-bold mb-2">¥45.00</p>
                <button class="w-full bg-custom text-white py-2 !rounded-button">加入购物车</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <section class="container mx-auto px-6 py-12">
      <h2 class="text-3xl font-bold mb-8">宠物饲养指南</h2>
      <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
        <div class="bg-white rounded-lg shadow-lg p-6">
          <div class="text-4xl text-custom mb-4">
            <i class="fas fa-bone"></i>
          </div>
          <h3 class="text-xl font-semibold mb-4">科学喂养</h3>
          <p class="text-gray-600">了解宠物的营养需求,制定合理的喂养计划,确保宠物健康成长。</p>
        </div>
        <div class="bg-white rounded-lg shadow-lg p-6">
          <div class="text-4xl text-custom mb-4">
            <i class="fas fa-heart"></i>
          </div>
          <h3 class="text-xl font-semibold mb-4">日常护理</h3>
          <p class="text-gray-600">定期为宠物梳理毛发,清洁卫生,保持良好的生活环境。</p>
        </div>
        <div class="bg-white rounded-lg shadow-lg p-6">
          <div class="text-4xl text-custom mb-4">
            <i class="fas fa-hospital"></i>
          </div>
          <h3 class="text-xl font-semibold mb-4">健康管理</h3>
          <p class="text-gray-600">定期体检和疫苗接种,预防疾病,保障宠物健康。</p>
        </div>
      </div>
    </section>

    <footer class="bg-gray-900 text-white">
      <div class="container mx-auto px-6 py-12">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
          <div>
            <h3 class="text-lg font-semibold mb-4">联系我们</h3>
            <p>电话:400-888-8888</p>
            <p>邮箱:service@petshop.com</p>
          </div>
          <div>
            <h3 class="text-lg font-semibold mb-4">营业时间</h3>
            <p>周一至周日</p>
            <p>09:00 - 21:00</p>
          </div>
          <div>
            <h3 class="text-lg font-semibold mb-4">地址</h3>
            <p>北京市朝阳区宠物大街88号</p>
          </div>
          <div>
            <h3 class="text-lg font-semibold mb-4">关注我们</h3>
            <div class="flex space-x-4">
              <a href="#"><i class="fab fa-weixin text-2xl"></i></a>
              <a href="#"><i class="fab fa-weibo text-2xl"></i></a>
            </div>
          </div>
        </div>
        <div class="border-t border-gray-800 mt-8 pt-8 text-center">
          <p>&copy; 2024 宠物之家. 保留所有权利</p>
        </div>
      </div>
    </footer>
  </div>
  <script src="js/glide.min.js"></script>
</body>
</html>

六、获取代码

内附源码,含5个页面。欢迎留言。

相关推荐
Python之栈6 分钟前
GitHub年度报告发布!Python首次超越JavaScript
javascript·python
幽兰的天空12 分钟前
HTML 面试题全解析
前端·html
鹿守心畔光34 分钟前
react常用hooks
前端·react.js
chengma_09090936 分钟前
elasticsearch 7.6.2版本即使使用wildcard模糊查询,也毫无过滤效果分析
java·服务器·前端
m0_7388202043 分钟前
前端模拟接口工具-json-server
前端·json
coderGhoul1 小时前
css 数据类型简述
css
姬嘉晗-19期-河北工职大1 小时前
jQuery总结(思维导图+二维表+问题)
前端·javascript·jquery
逆旅行天涯1 小时前
【Threejs】从零开始(十)--加载gltf模型和压缩后的模型
前端
王家视频教程图书馆1 小时前
请求go web后端接口 java安卓端播放视频
android·java·前端
请叫我飞哥@1 小时前
HTML 基础
前端·html