我正在尝试制作this 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>
答案 0 :(得分:2)
.secondarySystemGroupedBackground
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上制作形状为rombus的形状,在其中放置图像并将其裁剪来起作用。