使用HTML,CSS和Bootstrap的组织结构图

时间:2020-08-27 12:28:07

标签: html css twitter-bootstrap bootstrap-4

我介绍了在这里找到的组织结构图: https://bootsnipp.com/snippets/eN3Q8

一切正常,但是我的树在水平方向变大了,像这样折断: enter image description here

我想使用overflow-x属性添加滚动条,但是它不起作用:

.tree ul {
    padding-top: 20px; position: relative;
    overflow-x: scroll;
    transition: all 0.5s;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
}

这是一个CodePen链接:https://codepen.io/vladnicu/pen/zYqwdyv

谢谢!

1 个答案:

答案 0 :(得分:1)

您必须设置一个min-width以避免图表像这样折断:

.tree {
  min-width: 676px;
  overflow-x: scroll;
}

在您的示例中,676px位于其正常工作的最后宽度。这就是为什么我选择它。

现在您可以根据需要水平滚动了

Resulting scrollable containers

相关问题