微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html写出来的好玩的源代码

HTML是一种标记语言,它可以让我们创建有趣和互动的网页。下面是一些有趣的HTML源代码,可以让你的网页变得更加有趣。

<!DOCTYPE html>
<html>
<head>
  <title>我的炫酷网页</title>
</head>
<body>
  <h1>欢迎来到我的网页!</h1>
  
  <!--利用CSS样式来创建彩虹文本-->
  <p style="background: -webkit-linear-gradient(left,red,orange,yellow,green,blue,purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">这是一个彩虹文本!</p>
  
  <!--创建一个旋转的球体-->
  <div style="width: 50px; height: 50px; background: linear-gradient(135deg,white 25%,black 25%,black 50%,white 50%,white 75%,black 75%); border-radius: 50%; animation: spin 2s infinite linear;"></div>
  
  <!--创建一个3D动画的方块-->
  <div style="width: 100px; height: 100px; background: yellowgreen; position: relative;">
    <div style="top: 25px; left: 25px; width: 50px; height: 50px; background: aqua; position: absolute; transform: rotateX(45deg) rotateZ(45deg);"></div>
  </div>
  
  <!--利用canvas绘制一个太阳-->
  <canvas id="sun" width="200" height="200"></canvas>
  <script>
    var canvas = document.getElementById('sun');
    var ctx = canvas.getContext('2d');
    ctx.beginPath();
    ctx.arc(100,100,50,2 * Math.PI);
    ctx.fillStyle = 'yellow';
    ctx.fill();
    ctx.beginPath();
    ctx.moveto(100,100);
    ctx.lineto(150,150);
    ctx.strokeStyle = 'yellow';
    ctx.linewidth = 5;
    ctx.stroke();
  </script>
  
</body>
</html>

html写出来的好玩的源代码

这些源代码可以让你的网页变得更加富有创意和趣味性。与其他网页不同,你的网页会更加有个性和吸引力,吸引更多的访问者。坚持学习HTML并玩转源代码,你将能创建出令人惊艳的网页。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐