Как можно сделать края у дива как на фото которое я прикрепил?
Ответы (2 шт):
Автор решения: Zhihar
→ Ссылка
примерно так:
body,
header h1 {
margin: 0;
padding: 0;
}
/*height of wave = h = 50px*/
header {
background: darkblue;
width: 400px;
height: 150px;
color: #fff;
padding: 8px;
padding-bottom: 50px; /*h*/
position: relative;
overflow: hidden;
}
header:before,
header:after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 25px; /*h/2*/
height: 50px; /*h*/
background: radial-gradient(closest-side, #fff, #fff 50%, transparent 50%);
/*or farthest-side*/
background-size: 50px 50px; /*h h*/
background-position: 0 25px; /*0 h/2*/
background-repeat: repeat-x;
}
header:after {
background: radial-gradient(
closest-side,
transparent,
transparent 50%,
#fff 50%
);
/*or farthest-side*/
background-size: 50px 50px; /*h h*/
background-position: 25px -25px; /*h/2 -h/2*/
background-repeat: repeat-x;
bottom: -25px;
}
<header class="wave">
</header>
Автор решения: UModeL
→ Ссылка
CSS3 со своими градиентами творят чудеса! По-моему, похоже получилось:
body{margin:0;height:100vh;background-color:#e5e5e5;background-image:url(https://i.stack.imgur.com/m9NKc.png);background-position:0% 0%;background-repeat:no-repeat;background-size:auto;display:flex;justify-content:flex-end;align-items:center}
.ticket {
height: 90%; width: 90%;
background-color: transparent;
background-image: linear-gradient(to right, #000 1px, transparent 2px), linear-gradient(to right, #000 8px, transparent 8px, transparent 30px), linear-gradient(to right, #000 8px, transparent 8px, transparent 30px), linear-gradient(to bottom, #dff1f6, #f9fcfd), radial-gradient( circle closest-side, transparent 9px, #000 10px, #dff1f6 11px), radial-gradient( circle closest-side, transparent 9px, #000 10px, #f9fcfd 11px);
background-size: 1px 100%, 30px 1px, 30px 1px, 100% calc(100% - 24px), 30px 22px, 30px 22px;
background-position: 0 0, 0 0, 0 100%, 0 12px, 4px -10px, 4px calc(100% - -10px);
background-repeat: no-repeat, repeat-x, repeat-x, no-repeat, repeat-x, repeat-x;
filter: drop-shadow(0px 3px 3px #000a);
}
<div class="ticket"></div>
