使用CSS创建光泽的灯光效果

Alv*_*oao 5 html css css3 css-shapes

我正在尝试仅使用CSS和HTML创建灯光效果.就像这张图片一样
在此输入图像描述

我不知道是否有可能.或者怎么做

任何帮助将不胜感激.

.circle {
  border: 10px solid;
  border-radius: 50%;
  width: 200px;
  height: 200px;
  background-color: green;
}
Run Code Online (Sandbox Code Playgroud)
<div class="circle"></div>
Run Code Online (Sandbox Code Playgroud)

Ily*_* B. 12

这是我的例子

*,
*:before,
*:after {
  box-sizing: border-box;
}
div {
  width: 120px;
  height: 120px;
  border-radius: 60px;
  background: linear-gradient(to bottom, #393939 0%, #151515 100%);
  position: relative;
}
div:before {
  content: '';
  width: 106px;
  height: 106px;
  border-radius: 53px;
  background: #19f000;
  border: 1px solid black;
  position: absolute;
  left: 7px;
  top: 7px;
}
div:after {
  content: '';
  width: 80px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
  position: absolute;
  transform: rotate(-18deg);
  left: 13px;
  top: 9px;
}
Run Code Online (Sandbox Code Playgroud)
<div></div>
Run Code Online (Sandbox Code Playgroud)

JSfiddle演示


Jon*_*man 6

您可以使用第二个div用于高光来尝试提供更强的 3D 效果,从而将其box-shadow用于边缘上较暗的轮廓。

.circle {
  width: 164px;
  height: 164px;
  background-color: #19f000;
  border-radius: 100%;
  position: relative;
  border: 10px solid #444444;
  box-shadow: 0 0 15px 0 rgba(0,0,0,.8) inset;
  transform: rotate(-20deg);
}

.highlight {
  position: absolute;
  top: 2px;
  right: 0;
  left: 0;
  margin: auto;
  width: 80%;
  height: 64%;
  opacity: .92;
  border-radius: 100%;
  
  /* gratuitous gradient compatibility - activate! */
  background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
  background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
  background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
}
Run Code Online (Sandbox Code Playgroud)
<div class="circle">
<div class="highlight"></div>
</div>
Run Code Online (Sandbox Code Playgroud)