html/css实现简易圣诞贺卡

一、前言

HTML,全称HyperText Markup Language,即超文本标记语言,是用于创建网页的标准标记语言。HTML是一种标记语言,由一系列的元素标签组成,用于描述网页的结构和内容。
CSS,全称是“层叠样式表”(Cascading Style Sheets),是一种用于描述HTML或XML(包括如SVG、MathML等派生语言)文档样式的计算机语言。CSS是网页设计的重要组成部分,它能够定义网页的布局、颜色、字体和动画等。
结合html标签,使用css的animation方法实现一个跳动的,来表达心情的。。。

二、创意名

跳动的心

三、效果展示

在这里插入图片描述

四、实现步骤

  1. html创建标签
  2. css实现动态效果

五、编码实现

<!DOCTYPE html>  
<html>  
<head>  
  <title>圣诞贺卡</title>  
  <style>  
    body {
     
      background-color: #f0f0f0;  
      font-family: Arial, sans-serif;  
      text-align: center;  
    }  
      
    .card {
     
      display: inline-block;  
      background-color: #ff9999;  
      border: 2px solid #996666;  
      padding: 10px;  
      margin: 10px;  
      font-size: 20px;  
      height: calc(100vh - 60px);
    }  
      
    .card-header {
     
      font-weight: bold;  
      font-size: 24px;  
      margin-bottom: 10px;  
    }  
      
    .card-content {
     
      font-size: 18px;  
      line-height: 1.5;  
    }  
      
    .card-footer {
     
      font-size: 16px;  
      color: #663333;  
      margin-top: 10px;  
    }
    .main-content {
   
      position: absolute;
      width: 420px;
      height: 400px;
      top: 50%;
      left: 50%;
      margin-top: -200px;
      margin-left: -210px;
      animation: love 1s infinite alternate;
    }

    .main-content p {
   
      z-index: 1;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
      width: 100px;
      height: 30px;
      color: yellow;
    }

    .love-left {
   
      width: 200px;
      height: 350px;
      background-color: red;
      transform: translate(55px) rotate(-45deg);
      border-radius: 120px 120px 0 0;
      box-shadow: 0 0 80px 0 red;
    }

    .love-right {
   
      position: relative;
      top: -350px;
      width: 200px;
      height: 350px;
      background-color: red;
      transform: translate(161px) rotate(45deg);
      border-radius: 120px 120px 0 0;
      box-shadow: 0 0 80px 0 red;
    }

    @keyframes love {
   

      0% {
   
        transform: scale(1);
      }

      50% {
   
        transform: scale(0.6);
      }

      100% {
   
        transform: scale(1.2);
      }
    }

    .main-content:hover {
   
      animation-play-state: paused;
    }
  </style>  
</head>  
<body>  
  <div class="card">  
    <div class="card-header">圣诞快乐!</div>  
    <div class="card-content">  
      愿这个圣诞节带给你无尽的欢乐和温馨。愿你的每一天都充满爱和幸福。  
    </div>  
    <div class="main-content">
      <div class="love-left"></div>
      <div class="love-right"></div>
    </div>
    <div class="card-footer">来自你的朋友</div>  
  </div>  
</body>  
</html>

相关推荐

  1. HTMLCSS旋转的圣诞树源码附注释

    2023-12-23 07:48:01       41 阅读
  2. HTML实现圣诞树

    2023-12-23 07:48:01       42 阅读
  3. Python绘制一个简单圣诞树

    2023-12-23 07:48:01       32 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-23 07:48:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-23 07:48:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-23 07:48:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-23 07:48:01       20 阅读

热门阅读

  1. hive高级查询

    2023-12-23 07:48:01       35 阅读
  2. MAX96712学习记录及编程实践

    2023-12-23 07:48:01       42 阅读
  3. 鼠标悬浮在树组件节点上展示当前节点名称

    2023-12-23 07:48:01       38 阅读
  4. Linux基础 - Linux ARM 原子读写

    2023-12-23 07:48:01       39 阅读
  5. [node] Node.js的全局对象Global

    2023-12-23 07:48:01       33 阅读
  6. ip addr和ifconfig区别

    2023-12-23 07:48:01       41 阅读