CSS样式的Trello类板卡

时间:2018-07-01 15:29:19

标签: html css

我正在构建一个内部装有卡的板,就像Trello板一样。

The JSFiddle is here

代码如下:

<div class="board-container">
    <div class="board-top-menu">
        <div class="board-top-menu-item">TOP MENU ITEM 1</div>
        <div class="board-top-menu-item">TOP MENU ITEM 2</div>
    </div>
    <div class="board-content">
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 1</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 2</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 3</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 4</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

和样式表:

.board-container {
  padding: 0px;
  margin: 0px;
  display: flex;
  flex-direction: column;
}

.board-top-menu {
  width: 100%;
  background-color: grey;
  display: flex;
  flex-direction: row;
  padding: 5px;
}

.board-top-menu-item {
  padding: 5px;
}

.board-top-menu-item:hover {
  background-color: #fefefe;
}

.board-content {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px;
  background-color: white;
  white-space: nowrap;
  height: 100%;
  width: 100%;
}

.cards {
  height: 100%;
  overflow-y: auto;
  padding-bottom: 20px;
}

.cards-container {
  width: 270px;
  display: inline-block;
  height: 100%;
  overflow: hidden;
  min-height: 100px;
  background-color: #e2e4e6;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  padding-bottom: 20px;
  margin-right: 10px;
  vertical-align: top;
}

.cards-container-head {
  position: relative;
  padding: 10px 15px;
  margin-bottom: 5px;
}

.cards-container-title {
  font-weight: bold;
  white-space: normal;
  width: 100%;
}

.card-container {
  width: 100%;
  margin: 0 auto 10px;
  background-color: #fff;
  min-height: 100px;
  border-radius: 5px;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
  transition: 0.15s;
}

.card-header {
  padding: 5px 10px;
  border-bottom: 1px solid #dbdbdb;
  white-space: normal;
  word-break: break-all;
  word-wrap: break-world;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

我不能使我的面板水平滚动以查看所有名片盒,也不能垂直滚动到名片盒内。

有时,如小提琴所示,容器会卡在另一个容器上,有时它们会滚动整个页面,而不仅是容器。

3 个答案:

答案 0 :(得分:0)

.board-container {
  padding: 0px;
  margin: 0px;
  display: flex;
  flex-direction: column;
}

.board-top-menu {
  width: 100%;
  background-color: grey;
  display: flex;
  flex-direction: row;
  padding: 5px;
}

.board-top-menu-item {
  padding: 5px;
}

.board-top-menu-item:hover {
  background-color: #fefefe;
}

.board-content {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px;
  background-color: white;
  white-space: nowrap;
  height: 100%;
  width: 100%;
}

.cards {
  height: 100%;
  overflow-y: auto;
  padding-bottom: 20px;
}

.cards-container {
  width: 270px;
  display: inline-block;
  height: 100%;
  overflow: auto;
  min-height: 100px;
  background-color: #e2e4e6;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  padding-bottom: 20px;
  vertical-align: top;
}

.cards-container-head {
  position: relative;
  padding: 10px 15px;
  margin-bottom: 5px;
}

.cards-container-title {
  font-weight: bold;
  white-space: normal;
  width: 100%;
}

.card-container {
  width: 100%;
  margin: 0 auto 10px;
  background-color: #fff;
  min-height: 100px;
  border-radius: 5px;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
  transition: 0.15s;
}

.card-header {
  padding: 5px 10px;
  border-bottom: 1px solid #dbdbdb;
  white-space: normal;
  word-break: break-all;
  word-wrap: break-world;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
<div class="board-container">
    <div class="board-top-menu">
        <div class="board-top-menu-item">TOP MENU ITEM 1</div>
        <div class="board-top-menu-item">TOP MENU ITEM 2</div>
    </div>
    <div class="board-content">
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 1</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 2</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 3</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="cards-container">
            <div class="cards-container-head">
                <div class="cards-container-title">Test Panel 4</div>
            </div>
            <div class="cards">
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 01</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
                <div class="cards-container">
                    <div class="cards-container-head">
                        <div class="cards-container-title">ITEM 02</div>
                        <div />

                    </div>
                    <div class="card-container">
                        <div class="card-header">Material 1
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

答案 1 :(得分:0)

我认为您在元素嵌套方面存在问题。具有cards-container类的元素似乎嵌套在具有相同类的其他元素中。 See the fiddle

.board-container {
  padding: 0px;
  margin: 0px;
  display: flex;
  flex-direction: column;
}

.board-top-menu {
  width: 100%;
  background-color: grey;
  display: flex;
  flex-direction: row;
  padding: 5px;
}

.board-top-menu-item {
  padding: 5px;
}

.board-top-menu-item:hover {
  background-color: #fefefe;
}

.board-content {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px;
  background-color: white;
  white-space: nowrap;
  height: 100%;
  width: 100%;
}

.cards {
  height: 100%;
  overflow-y: auto;
  padding-bottom: 20px;
}

.cards-container {
  width: 270px;
  display: inline-block;
  height: 100%;
  overflow: hidden;
  min-height: 100px;
  background-color: #e2e4e6;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  padding-bottom: 20px;
  margin-right: 10px;
  vertical-align: top;
}

.cards-container-head {
  position: relative;
  padding: 10px 15px;
  margin-bottom: 5px;
}

.cards-container-title {
  font-weight: bold;
  white-space: normal;
  width: 100%;
}

.card-container {
  width: 100%;
  margin: 0 auto 10px;
  background-color: #fff;
  min-height: 100px;
  border-radius: 5px;
  box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
  transition: 0.15s;
}

.card-header {
  padding: 5px 10px;
  border-bottom: 1px solid #dbdbdb;
  white-space: normal;
  word-break: break-all;
  word-wrap: break-world;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
/*Get rid of scrollbar from html */
html {
    overflow-x: hidden;
}
/* Add vertical scroll to card container */
.card-container{
  height: 50px;
  overflow-y: scroll;
}
<div class="board-container">
  <div class="board-top-menu">
    <div class="board-top-menu-item">TOP MENU ITEM 1</div>
    <div class="board-top-menu-item">TOP MENU ITEM 2</div>
  </div>
  <div class="board-content">
    <div>
      <div class="cards-container-head">
        <div class="cards-container-title">Test Panel 1</div>
      </div>
      <div class="cards">
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
        <div class="cards-container">
          <div class="cards-container-head">
            <div class="cards-container-title">ITEM 01</div>
          </div>
          <div class="card-container">
            <div class="card-header">Material 1</div>
          </div>
        </div>
      </div>
    </div>
  </div>

答案 2 :(得分:0)

提供的html有点混乱,但是我认为您需要这样的东西:

<div class="board-top-menu">
    <div class="board-top-menu-item">TOP MENU ITEM 1</div>
    <div class="board-top-menu-item">TOP MENU ITEM 2</div>
</div>

<div class="board-container">
<div class="cards-container">
    <div class="cards-container-head">
        <div class="cards-container-title">Test Panel 1</div>
    </div>
    <div class="cards">
        <div class="card-container">
            <div class="cards-container-head">
                <div class="cards-container-title">ITEM 01</div>
            </div>
            <div class="card-container">
                <div class="card-header">Material 1</div>
            </div>
        </div>
        <div class="card-container">
              <div class="cards-container-head">
                  <div class="cards-container-title">ITEM 01</div>
              </div>
              <div class="card-container">
                  <div class="card-header">Material 1</div>
              </div>
          </div>
        <div class="card-container">
              <div class="cards-container-head">
                  <div class="cards-container-title">ITEM 01</div>
              </div>
              <div class="card-container">
                  <div class="card-header">Material 1</div>
              </div>
          </div>
    </div>
</div>
<div class="board-content">content</div>

我对CSS的处理不多,但应该是这样的:

body { overflow:hidden; }
.board-container {
    padding: 0px;
    margin: 0px;
}

.board-top-menu {
    width: 100%;
    background-color: grey;
    display: flex;
    flex-direction: row;
    padding: 5px;
}

.board-top-menu-item {
    padding: 5px;
}

.board-top-menu-item:hover {
    background-color: #fefefe;
}

.board-content {
    display: inline-block;
    float: left;
    padding: 5px;
    background-color: white;
    white-space: nowrap;
    height: 100%;
    width: calc(100% - 300px);
}

.cards {
    height: 100vh;
    overflow-y: scroll;
    padding-bottom: 20px;
}

.cards-container {
    width: 270px;
    float: left;
    display: inline-block;
    height: 100%;
    min-height: 100px;
    background-color: #e2e4e6;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    padding-bottom: 20px;
    margin-right: 10px;
    vertical-align: top;
}

.cards-container-head {
    position: relative;
    padding: 10px 15px;
    margin-bottom: 5px;
}

.cards-container-title {
    font-weight: bold;
    white-space: normal;
    width: 100%;
}

.card-container {
    width: 100%;
    margin: 0 auto 10px;
    background-color: #fff;
    min-height: 100px;
    border-radius: 5px;
    box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
    transition: 0.15s;
}

.card-header {
    padding: 5px 10px;
    border-bottom: 1px solid #dbdbdb;
    white-space: normal;
    word-break: break-all;
    word-wrap: break-world;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

See this pen