如何创建圆角矩形形状Css?

Kas*_*tif 5 html css rounded-corners css-shapes

我正试图设计一个像这样的轮廓图像形状

正确的图像设计

但我的代码给了我以下设计

我的设计

我担心边框内的空白区域,这里的形状是代码

.doctor-profile-photo {
  width: 210px;
  height: 210px;
  border-radius: 60px/140px;
  border: 5px solid #000;
  box-shadow: 0px 2px 5px #ccc;
}
.doctor-profile-photo img {
  width: 100%;
  height: 100%;
  border-radius: 60px/140px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="doctor-profile-photo">
  <img src="http://weknowyourdreams.com/images/bird/bird-09.jpg" alt="">
</div>
Run Code Online (Sandbox Code Playgroud)

Nij*_*ani 4

这给出了与您想要的非常相似的输出。尝试调整 border-radius 和 height-width 的值以达到您想要的效果。

<style>
 #pic { 
    position: relative;     
    width: 130px; 
    height: 150px; 
    margin: 20px 0; 
    background: red; 
    border-radius: 50% / 10%; 
    color: white; 
    text-align: center; 
    text-indent: .1em;
 } 
 #pic:before { 
    content: ''; 
    position: absolute; 
    top: 10%; 
    bottom: 10%; 
    right: -5%; 
    left: -5%; 
    background: inherit; 
    border-radius: 5% / 50%; 
 } 
</style>
<div id="pic"></div>
Run Code Online (Sandbox Code Playgroud)

这是一个有用的链接:https ://css-tricks.com/examples/ShapesOfCSS/