1

我正在尝试制作这个 UI

在此处输入图像描述

在此处输入图像描述

为了制作这个上部蓝色容器,我使用了剪辑路径方法。

你能告诉我如何在医生图像后面添加菱形并使其在右下角变圆吗?

*{
    margin: 0px;
    padding: 0px;
}
.data{
    /* background-color: yellow; */
    width: 40%;
    padding-top: 63px;
    padding-left: 29px;
}
ul{
    display: flex;
    list-style: none;
    
}
li{
    margin: 10px;
}
.nav{
    /* float: right; */
    margin-right: 37%;
   display: flex;
   align-items: center;
    justify-content: space-between;
}
button{
    border-radius: 10px;
    color: #03A9F4;
    border: none;
    padding: 8px;
}

#logo{
    height: 54px;border-bottom-right-radius: 15px;}

#title{
    font-size: 53px;
    font-weight: bold;
}

#subtitle{
    font-size: 1.5rem;
    font-weight: bold;
}
#about{
    margin-top: 10px;
    margin-bottom: 10px;
}
#doctor{
    position: absolute;
    left: 47%;
    top: 15%;
}
#body{
background-image: url("../assets/back.png");
height: 100vh;
width: 100wh;
background-size: cover;
background-repeat: no-repeat;
}


.home {
    
    background: #03A9F4;
    width: 100%;
    color: white;
    height: 65vh;
    clip-path: polygon(0% 0%,65% 0%,43% 100%,0% 100%);
    }
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="home.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
 <div id="body">
    <div class="home">
        <div class="nav">
           <div id="logo"><img  src="../assets/logo (3).png" alt=""/></div>
            <ul>
               <li>Home</li>         
               <li>About Us</li>         
               <li>Contact Us</li>
           </ul>
        </div>
     <div class="data">
       <div id="title">Best Doctor</div>
       <div id="subtitle">Best Treatment</div>
       <div id="about">Lorem Ipsum is simply dummy text of the printing and typesetting industry.It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged</div>
       <button>Search Doctor</button>
   </div>
    </div>    
    <div id="doctor"> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT7TMH4j7DUVZmCNB-7mt9cRDRUGXJKyUbxYw&usqp=CAU" alt="">>
    </div> 
 </div>
</body>
</html>

4

1 回答 1

2

img {
  transform:rotate(-45deg);
  position:absolute;
  top:-25%;
  left:-25%;
}

div {
  width: 100px;
  height: 100px;
  transform:rotate(45deg);
  overflow: hidden;
  border-radius: 10px;

  /* Position away from the corner: */
  position: absolute;
  top: 50px;
  left: 50px;
}
<div>
<img width="150px" height="150px" src="https://img.freepik.com/free-vector/doctor-character-background_1270-84.jpg?size=338&ext=jpg">
</div>

它的工作原理是从一个 div 中制作一个 rombus 形状,在里面放置一个图像,然后裁剪它。

于 2020-10-14T14:05:17.480 回答