1

Нужно установить на фон картинку, которая будет располагаться справа по центру. Так же фон блока должен быть серым.В html ничего менять нельзя. Возможно ли это?

.ztd {
  display: block;
  position: relative;
  width: 100%;
  height: 250px;
  border: 2px solid #000;
  margin-bottom: 50px;
}

.ztd {
  background-image: url()/* это и выше css */
}
<div class="ztd"> /* это html */
</div>

1 ответ 1

3

.ztd {
  display: block;
  position: relative;
  width: 100%;
  height: 250px;
  border: 2px solid #000;
  margin-bottom: 50px;
  background: #ccc
}

.ztd:after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: url(https://palmitoylethanolamideblog.com/wp-content/uploads/2016/08/nature.jpg) no-repeat center top;
  background-size: cover;
}
<div class="ztd"></div>

Ваш ответ

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

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