用HTML编写各式各样的图形

一.圆环

1.代码部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style type="text/css">
     #one{
     	width: 400px;
     	height: 400px;
     	background-color: #93baff;
     	border-radius: 200px;
 }
 #two{
 	width: 200px;
 	height: 200px;	
 	position: relative;
 	left:100px;
 	top: 100px;
 	background-color: white;
 	border-radius:100px;
 }
    </style>
</head>
<body>
	<div id="one">
		<div id="two"></div> 
	</div>
</body>
</html>

2.效果图

在这里插入图片描述

二.四色板

1.代码部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style type="text/css">
       #one{
       	width: 0;
       	border-top:100px solid #FF898E; 
        border-bottom: 100px solid #C89386;
       	border-left: 100px solid #FFB151;
       	border-right: 100px solid #93BAFF;

       }
    </style>
</head>
<body>
	<div id="one"></div>
</body>
</html>

2.效果图

在这里插入图片描述

三.八色板

1.代码部分


```css
```css
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <style type="text/css">
        #o{
          position: center;
        }
       #one{
       	width: 0;
       	border-top:20px solid #92D050; 
        border-bottom: 20px solid #FFFF00;
       	border-left: 20px solid #92D050;
       	border-right: 20px solid #FFFF00;
       }
       #two{
        width: 0px;
        border-top:20px solid #FF0000; 
        border-left: 20px solid #0070C0;
        border-right: 20px solid #FF0000;
        border-bottom: 20px solid #0070C0;
        position: relative;
        left: 40px;
        top: -80px;
       }
       #three{
        width: 0px;
        border-top:20px solid black; 
        border-left: 20px solid #7030A0;
        border-right: 20px solid black;
        border-bottom: 20px solid #7030A0;
       }
       #four{
        width: 0px;
        border-top:20px solid white; 
        border-left: 20px solid white;
        border-right: 20px solid #00B0F0;
        border-bottom: 20px solid #00B0F0;
        position: relative;
        left: 40px;
        top: -80px;
       }
    </style>
</head>
<body>
    <div id="o">
	   <div id="one"></div>
     <div id="three"></div>
     <div id="two"></div>
     <div id="four"></div>
      </div> 

</body></html>

2.效果图

在这里插入图片描述

四.八色板2

1.代码部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style type="text/css">
       #one{
        width: 0;
        border-top:20px solid #FF0000; 
        border-bottom: 20px solid #70AD47;
        border-left: 20px solid #70AD47;
        border-right: 20px solid #FF0000;
       }
       #two{
        width: 0px;
        border-top:20px solid #44546A; 
        border-left: 20px solid #44546A;
        border-right: 20px solid #FFFF00;
        border-bottom: 20px solid #FFFF00;
        position: relative;
        left: 40px;
        top: -80px;
       }
       #three{
        width: 0px;
        border-top:20px solid #7030A0; 
        border-left: 20px solid #7030A0;
        border-right: 20px solid #002060;
        border-bottom: 20px solid #002060;
       }
       #four{
        width: 0px;
        border-top:20px solid #FFC000; 
        border-left: 20px solid #00B0F0;
        border-right: 20px solid #FFC000;
        border-bottom: 20px solid #00B0F0;
        position: relative;
        left: 40px;
        top: -80px;
       }
    </style>
</head>
<body>
     <div id="one"></div>
     <div id="three"></div>
     <div id="two"></div>
     <div id="four"></div>
</body>
</html>

2.效果图

在这里插入图片描述

五.五角星

1.代码部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <style type="text/css">
    #one {
      margin: 70px 0;
      position: relative;
      display: block;
      color: #5B9BD5;
      width: 0px;
      height: 0px;
      border-right:  100px solid transparent;
      border-bottom: 80px  solid #5B9BD5;
      border-left:   100px solid transparent;
      
  }
    #one:before {
      border-bottom: 80px solid #5B9BD5;
      border-left: 30px solid transparent;
      border-right: 30px solid transparent;
      position: absolute;
      height: 0;
      width: 0;
      top: -45px;
      left: -65px;
      display: block;
      content: '';
      transform: rotate(-35deg);

  }
    #one:after {
      position: absolute;
      display: block;
      color: #5B9BD5;
      top: 3px;
      left: -105px;
      width: 0px;
      height: 0px;
      border-right: 100px solid transparent;
      border-bottom: 70px solid #5B9BD5;
      border-left: 100px solid transparent;
      transform: rotate(-70deg);
      content: '';
  }
    </style>
</head>
<body>
	   <div id="one"></div>
</body>
</html>

2.效果图

在这里插入图片描述

六.爱心

1.代码部分

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
   <style type="text/css">
      div{
        position: absolute;
        left: 200px;
        top: 200px;
      }
       #one{
   			background-color: red;
   			height: 100px;
   			width: 100px;
   			transform: rotate(45deg);
   		}
   		#one:before{
        height: 100px;
        width: 100px;
        display: block;
        position: absolute;
        left:-45px;
        top:-0px;
        border-radius: 50px;
        background-color: red;
        content: " ";
      }
      #one:after{
        height: 100px;
        width: 100px;
        display: block;
        position: absolute;
        left:0px;
        top:-45px;
        border-radius: 50px;
        background-color: red;
        content: " ";
      }
    </style>
</head>
<body>
<div id="one"></div>
</body>
</html>

2.效果图

在这里插入图片描述

  • 7
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值