0

Как можно реализовать подобную рамку вместе со свойством border-radius? То что должно получиться: https://i.imgur.com/y8kksG1.png

.map {
  width: 100%;
  max-width: 900px;
  position: relative;
  border-radius: 100px 0px;
  overflow: hidden;
}

.map:before,
.map:after,
.map-wrap:before,
.map-wrap:after {
  content: '';
  position: absolute;
  display: block;
  background-color: rgba(234, 234, 234, 0.6);
}

.map:before,
.map:after {
  width: 10px;
  top: 0;
  bottom: 0;
}

.map:after {
  right: 0;
}

.map-wrap:before,
.map-wrap:after {
  height: 10px;
  left: 10px;
  right: 10px;
}

.map-wrap:after {
  bottom: 0;
}

.map iframe {
  display: block;
}
<div class="map">
  <div class="map-wrap">
    <iframe src="https://yandex.ru/map-widget/v1/-/CCUjn-VQkC" width="100%" height="345" frameborder="0" allowfullscreen="true"></iframe>
  </div>
</div>

1 ответ 1

1

Можно добавить отдельный блок c абсолютным позиционированиием, который будет повторять форму враппера c классом map. Но чтобы он не перекрывал компонент карты и не мешал, этому блоку с рамкой нужно добавить свойство pointer-events со значением none, тогда он не сможет стать целью событий указателя и все эвенты(click, mousemove и т.д) будут проходить "сквозь" него.

.map {
  width: 100%;
  max-width: 900px;
  position: relative;
  overflow: hidden;
}

.map, .map-border {
  border-radius: 100px 0px;
}

.map iframe {
  display: block;
}

.map-border {
  border: 10px solid #00000030;
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
<div class="map">
  <div class="map-wrap">
    <iframe src="https://yandex.ru/map-widget/v1/-/CCUjn-VQkC" width="100%" height="345" frameborder="0" allowfullscreen="true"></iframe>
  </div>
  <div class="map-border"></div>
</div>

Топик на MDN - pointer-events

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.