Разделенный экран на две части с разной шириной - PullRequest
0 голосов
/ 23 февраля 2019

Я пытаюсь разделить страницу на 2 части, но разных размеров.С помощью следующего кода я получаю 2 части, но с одинаковым размером.

http://jsfiddle.net/aL78z6kf/

HTML-часть:

<div class="split left">
  <div class="centered">
      <h2>Jane Flex</h2>
    <p>Some text.</p>
  </div>
</div>

<div class="split right">
  <div class="centered">
    <h2>John Doe</h2>
    <p>Some text here too.</p>
  </div>
</div>

И Css:

.split {
  height: 100%;
  width: 50%;
  position: fixed;
  z-index: 1;
  top: 0;
  overflow-x: hidden;
  padding-top: 20px;
}

/* Control the left side */
.left {
  left: 0;
  background-color: orange;
}

/* Control the right side */
.right {
  right: 0;
  background-color: red;
}

/* If you want the content centered horizontally and vertically */
.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* Style the image inside the centered container, if needed */
.centered img {
  width: 150px;
  border-radius: 50%;
}

Возможно ли это сделать?Заранее спасибо

1 Ответ

0 голосов
/ 23 февраля 2019

JsFiddle

Удалить width:50% из .split класса.И добавьте свойства ширины (что хотите) в .left и .right class.

/* Control the left side */
.left {
  left: 0;
  background-color: orange;
  width: 30%;
}

/* Control the right side */
.right {
  right: 0;
  background-color: red;
  width: 70%;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...