html代码 满屏爱心
导读:你是否曾经想过,让你的网页充满爱的气息?那么今天,就让我们来学习一种让网页满屏爱心的HTML代码吧。<!DOCTYPE html><html><head> <title>满屏爱心<...
你是否曾经想过,让你的网页充满爱的气息?那么今天,就让我们来学习一种让网页满屏爱心的HTML代码吧。
!DOCTYPE html> html> head> title> 满屏爱心/title> style> body { margin: 0; padding: 0; background: #000; } .heart { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 20px; height: 20px; background: #f00; transform-origin: center; animation: heartBeat 1s ease-out infinite; } .heart:before, .heart:after { content: ""; position: absolute; left: 10px; top: 0; width: 20px; height: 20px; border-radius: 20px 20px 0 0; background: #f00; } .heart:after { left: 0; border-radius: 0 20px 20px 0; } @keyframes heartBeat { 0% { transform: scale(0.8); } 20% { transform: scale(1); } 40% { transform: scale(0.8); } 60% { transform: scale(1); } 80% { transform: scale(0.8); } 100% { transform: scale(0.8); } } /style> /head> body> div class="heart"> /div> /body> /html>
以上代码中,我们使用了CSS3的动画来制作出心形图案,并使用了固定定位使其充满整个屏幕,最后在HTML中放置一个div容器来装载这个心形图案。
如果你也想将你的网页变得浪漫又有趣,不妨试试以上HTML代码吧!
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: html代码 满屏爱心
本文地址: https://pptw.com/jishu/536462.html