2

Возникла проблема, хочу выровнять картинку и блок с вводом данных на одном уровне, но не могу уменьшить блок div, может кто-то подсказать решение?

введите сюда описание изображения

#information {
  position: relative;
  width: auto;
  margin-left: 70%;
}

#picture {
  margin-left: 10%;
  margin-top: 0;
}
1
  • Используйте флексы
    – Вадим
    17 авг 2020 в 5:03

1 ответ 1

1

Для этого можно воспользоваться Flex:

body {
  display: flex;
  align-items: center;
}

#information h1 {
  margin-top: 0;
}

#information p {
  margin-bottom: 0;
}

#picture {
  width: 140px;
  height: 200px;
  border: 1px solid red;
  margin-left: 30px; 
}
<div id="information">
  <h1>Information:</h1>
  <p>line 1</p>
  <p>line 2</p>
  <p>line 3</p>
</div>
<div id="picture"></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.

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