如何将图像放置在使用边界半径创建的圆内

时间:2018-08-29 17:13:08

标签: html5 css3

我正在尝试将星星放在圆圈上方。星形应为白色(现在为黑色),圆圈应为绿色。我无法更改星号的大小,圆的形状正确,因此请帮助将星放入圆中。

我从以下网址复制了星形的星星:https://css-tricks.com/examples/ShapesOfCSS/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>    
<style>
.circleDiv{
	width:70px;
	height: 70px;              
	border:2px solid #a1a1a1;
	border-radius:70%;
	background-color:green;       
}
#star-five {
   margin: 50px 0;
   position: relative;
   display: block;
   color: white;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid black;
   border-left:   100px solid transparent;
   -moz-transform:    rotate(35deg);
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   -o-transform:      rotate(35deg);
}
#star-five:before {
   border-bottom: 80px solid black;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -moz-transform:    rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   -o-transform:      rotate(-35deg);

}
#star-five:after {
   position: absolute;
   display: block;
   color: white;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid black;
   border-left: 100px solid transparent;
   -webkit-transform: rotate(-70deg);
   -moz-transform:    rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   -o-transform:      rotate(-70deg);
   content: '';
}
</style>
</HEAD>

<BODY>
    <div class="circleDiv">
	<span id="star-five"></span>
	</div>
</BODY>
</HTML>

0 个答案:

没有答案