柔性箱高度问题

时间:2016-09-05 09:21:13

标签: css css3 flexbox

CodePen:http://codepen.io/BamiGorengo/pen/vXEmXX

我得到了内容区域和侧边栏区域。我努力做到最好,让它完全响应,但与课堂上的div"聊天"在某些决议上没有正确的高度...

enter image description here



html {
  box-sizing: border-box; }

*, *::after, *::before {
  box-sizing: inherit; }

html {
  height: 100%; }
  html body {
    height: 100%;
    background-color: #fff;
    margin: 0;
    font-family: "Ubuntu", sans-serif; }

header {
  height: 80px;
  padding: 1em;
  display: -webkit-box;
  display: -moz-box;
  display: box;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flexbox;
  display: flex;
  background-color: #404040;
  box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.48); }

html body .live-chat {
  height: calc(100% - 80px);
  display: -webkit-box;
  display: -moz-box;
  display: box;
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flexbox;
  display: flex; }
  html body .live-chat .main {
    width: 100%;
    display: -webkit-box;
    display: -moz-box;
    display: box;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    box-orient: vertical;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    box-direction: normal;
    -webkit-flex-direction: column;
    -moz-flex-direction: column;
    flex-direction: column;
    -ms-flex-direction: column; }
    @media screen and (min-width: 768px) {
      html body .live-chat .main {
        width: 72%; } }
    html body .live-chat .main .live-video {
      background-position: 50%;
      background-color: #0c0c0c; }
      @media screen and (min-width: 992px) {
        html body .live-chat .main .live-video {
          padding: 0 80px; } }
      @media screen and (min-width: 1200px) {
        html body .live-chat .main .live-video {
          padding: 0 120px; } }
      @media screen and (min-width: 1500px) {
        html body .live-chat .main .live-video {
          padding: 0 240px; } }
      html body .live-chat .main .live-video img,
      html body .live-chat .main .live-video video {
        width: 100%;
        display: block; }
    html body .live-chat .main .chat {
      display: -webkit-box;
      display: -moz-box;
      display: box;
      display: -webkit-flex;
      display: -moz-flex;
      display: -ms-flexbox;
      display: flex;
      -webkit-box-orient: vertical;
      -moz-box-orient: vertical;
      box-orient: vertical;
      -webkit-box-direction: normal;
      -moz-box-direction: normal;
      box-direction: normal;
      -webkit-flex-direction: column;
      -moz-flex-direction: column;
      flex-direction: column;
      -ms-flex-direction: column;
      -webkit-flex-grow: 1;
      -moz-flex-grow: 1;
      flex-grow: 1;
      -ms-flex-positive: 1; }
      html body .live-chat .main .chat ul {
        min-height: 140px;
        margin: 0;
        padding: 20px;
        -webkit-flex-grow: 1;
        -moz-flex-grow: 1;
        flex-grow: 1;
        -ms-flex-positive: 1;
        overflow-x: hidden;
        overflow-y: auto;
        background-color: #404040; }
        html body .live-chat .main .chat ul li {
          list-style: none; }
          html body .live-chat .main .chat ul li .msg {
            color: #fff; }
          html body .live-chat .main .chat ul li.me .name {
            color: #4183D7; }
          html body .live-chat .main .chat ul li.other .name {
            color: #F62459; }
      html body .live-chat .main .chat .chat-input input {
        width: 100%;
        padding: 8px; }
  html body .live-chat .sidebar {
    width: 320px;
    min-width: 320px;
    height: calc(100% - 80px);
    padding: 10px;
    top: 80px;
    right: -320px;
    position: fixed;
    background-color: #242424; }
    @media screen and (min-width: 768px) {
      html body .live-chat .sidebar {
        width: 28%;
        height: 100%;
        position: inherit; } }
    @media screen and (min-width: 1200px) {
      html body .live-chat .sidebar {
        padding: 20px; } }
    html body .live-chat .sidebar.open {
      right: 0; }
    html body .live-chat .sidebar .widget {
      margin-bottom: 10px;
      padding: 10px;
      color: #fff;
      background-color: #0c0c0c;
      border-top-left-radius: 4px;
      border-top-right-radius: 4px;
      border-bottom-left-radius: 4px;
      border-bottom-right-radius: 4px; }
      html body .live-chat .sidebar .widget:last-child {
        margin-bottom: 0; }
      @media screen and (min-width: 1200px) {
        html body .live-chat .sidebar .widget {
          margin-bottom: 20px;
          padding: 20px; } }
      html body .live-chat .sidebar .widget h1 {
        margin: 0; }
      html body .live-chat .sidebar .widget .additional-info {
        padding-top: 10px;
        font-size: 14px; }
      html body .live-chat .sidebar .widget .user-images {
        padding: 10px 0;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto; }
        html body .live-chat .sidebar .widget .user-images::after {
          clear: both;
          content: "";
          display: block; }
        html body .live-chat .sidebar .widget .user-images > div {
          float: left;
          display: block;
          margin-right: 2.35765%;
          width: 31.76157%; }
          html body .live-chat .sidebar .widget .user-images > div:last-child {
            margin-right: 0; }
          html body .live-chat .sidebar .widget .user-images > div img {
            width: 100%;
            display: block; }
      html body .live-chat .sidebar .widget a {
        padding: 6px 10px;
        color: #fff;
        text-align: center;
        text-decoration: none;
        display: block;
        background-color: #F62459;
        border: 1px solid #fa7c9b;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        border-bottom-left-radius: 4px;
        border-bottom-right-radius: 4px; }
        html body .live-chat .sidebar .widget a:hover {
          background-color: #f10a44;
          border: 1px solid #fb92ac; }

<html>

<head>
  <title>Fun Chat</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
</head>

<body>

  <header>
    Logo
  </header>


  <div class="live-chat">

    <section class="main">
      <div class="live-video">
        <img src="https://upload.wikimedia.org/wikipedia/commons/c/c4/PM5544_with_non-PAL_signals.png">
      </div>
      <div class="chat">
        <ul>
          <li class="me"><span class="name">John</span> <span class="msg">Hallo?</span></li>
          <li class="other"><span class="name">John</span> <span class="msg">Hallo!</span></li>
        </ul>
        <div class="chat-input">
          <input>
        </div>
      </div>
    </section>

    <aside class="sidebar">
      <section class="widget user-info">
        asd
      </section>

      <section class="widget">
        asd
      </section>

      <section class="widget">
        asd
      </section>
    </aside>

  </div>



</body>

</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案