Как сверстать такой елемент?
Помогите, пожалуйста, сверстать такой элемент. Там вместо белого фона будет картинка, ее должно быть видно в промежутке между красным и серым блоками.
Ответы (1 шт):
Автор решения: Евгений Кулик
→ Ссылка
вот так?
.header {
height: 60px;
background-color: #999;
position: relative;
}
.icon {
display: inline-block;
position: relative;
margin: 20px;
width: 120px;
height: 80px;
border-radius: 50%;
overflow: hidden;
}
.icon:before {
content: '';
position: absolute;
top: 10px;
right: 10px;
width: calc(100% - 20px);
height: calc(100% - 20px);
background-color: #ff0000;
z-index: 1;
border-radius: 50%;
}
.icon img {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header">
<div class="icon"><img src="https://c.wallhere.com/photos/9b/e1/1920x1080_px_lake_landscape_nature-1404461.jpg!s" alt=""></div>
</div>
<script src="scripts.js"></script>
</body>
</html>
