代码 html一个全屏背景视频

2024-11-18 00:48:20 +0800 CST views 688

该文本是一个HTML文档,展示了一个名为“程序员茄子”的专业网站开发页面。页面包含一个全屏背景视频和中心内容,内容包括标题和描述,旨在吸引用户并提供联系链接。使用了CSS样式来设置布局、字体、动画效果和按钮样式,整体设计现代且具有视觉吸引力。

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>程序员茄子 - 专业网站开发</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        html, body {
            height: 100%;
            font-family: "Microsoft YaHei", sans-serif;
            overflow: hidden;
        }
        /* 背景视频样式 */
        .video-bg {
            position: fixed;
            top: 50%;
            left: 50%;
            min-width: 100%;
            min-height: 100%;
            width: auto;
            height: auto;
            z-index: -1;
            transform: translate(-50%, -50%);
            background-size: cover;
        }
        /* 内容样式 */
        .content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: #fff;
            animation: fadeIn 2s ease-in-out;
        }
        .content h1 {
            font-size: 80px;
            margin-bottom: 20px;
            letter-spacing: 5px;
            text-shadow: 2px 2px 10px rgba(0,0,0,0.7);
        }
        .content p {
            font-size: 24px;
            margin-bottom: 40px;
            text-shadow: 1px 1px 5px rgba(0,0,0,0.7);
        }
        /* 按钮样式 */
        .content a {
            display: inline-block;
            padding: 15px 30px;
            font-size: 18px;
            color: #fff;
            text-decoration: none;
            border: 2px solid #fff;
            border-radius: 30px;
            transition: background 0.5s, color 0.5s;
        }
        .content a:hover {
            background: #fff;
            color: #000;
        }
        /* 进入动画 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translate(-50%, -60%); }
            to { opacity: 1; transform: translate(-50%, -50%); }
        }
    </style>
</head>
<body>
    <!-- 背景视频 -->
    <video class="video-bg" autoplay muted loop>
        <source src="https://www.w3schools.com/howto/rain.mp4" type="video/mp4">
        您的浏览器不支持视频背景。
    </video>
    <!-- 内容部分 -->
    <div class="content">
        <h1>程序员茄子</h1>
        <p>专业网站开发,助您实现互联网梦想</p>
        <a href="#contact">联系我</a>
    </div>
</body>
</html>

images

复制全文 生成海报 网页设计 前端开发 用户体验

推荐文章

全栈工程师的技术栈
2024-11-19 10:13:20 +0800 CST
Shell 里给变量赋值为多行文本
2024-11-18 20:25:45 +0800 CST
Elasticsearch 条件查询
2024-11-19 06:50:24 +0800 CST
PHP来做一个短网址(短链接)服务
2024-11-17 22:18:37 +0800 CST
GROMACS:一个美轮美奂的C++库
2024-11-18 19:43:29 +0800 CST
PHP中获取某个月份的天数
2024-11-18 11:28:47 +0800 CST
Web 端 Office 文件预览工具库
2024-11-18 22:19:16 +0800 CST
curl错误代码表
2024-11-17 09:34:46 +0800 CST
Python 获取网络时间和本地时间
2024-11-18 21:53:35 +0800 CST
使用Python提取图片中的GPS信息
2024-11-18 13:46:22 +0800 CST
批量导入scv数据库
2024-11-17 05:07:51 +0800 CST
mysql int bigint 自增索引范围
2024-11-18 07:29:12 +0800 CST
windows下mysql使用source导入数据
2024-11-17 05:03:50 +0800 CST
内网穿透技术详解与工具对比
2025-04-01 22:12:02 +0800 CST
程序员茄子在线接单