मैं फ्लेक्सबॉक्स के साथ एक वृक्षदृश्य बनाता हूं, लेकिन मुझे क्रोम में काम करने के लिए लेआउट नहीं मिल रहा है। अतिप्रवाह काम नहीं करता है और लेआउट को नष्ट कर देता है।

फ़ायरफ़ॉक्स/आईई/एज में नीचे दिया गया कोड स्निपेट काम करता है जैसा कि मैं इसे अतिप्रवाह के साथ चाहता हूं।

इसकी स्क्रीन फ़ायरफ़ॉक्स में काम कर रही है:

Screen of it working in Firefox

लेकिन क्रोम में यह इसे प्रदर्शित करता है क्योंकि यह यहां कोड स्निपेट में है। मैं एफएफ/आईई में काम करने के लिए अतिप्रवाह कैसे प्राप्त कर सकता हूं?

/* WorkPackage Treeview */

.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-bottom,
.flex-tree-parent,
.flex-tree-children,
.flex-tree-child-button {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-parent {
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.flex-tree {
  min-width: 240px;
  max-width: 245px;
  min-height: 180px;
  max-height: 180px;
  position: absolute;
  border-style: solid;
  border-width: 1px;
  z-index: 100;
}

.flex-tree2 {
  min-width: 240px;
  max-width: 245px;
  min-height: 380px;
  max-height: 380px;
  position: absolute;
  border-style: solid;
  border-width: 1px;
  z-index: 100;
}

.flex-tree-content {
  min-height: 150px;
  max-height: 150px;
  background-color: White;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  overflow-y: scroll;
}

.flex-tree-content2 {
  min-height: 350px;
  max-height: 350px;
  background-color: White;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  overflow-y: scroll;
}

.flex-tree-bottom {
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-height: 32px;
  background-color: Gray;
  border-bottom-style: solid;
  border-bottom-width: 1px;
}

.flex-tree-parent {
  margin-left: 20px;
}

.flex-tree-parent>.flex-tree-children:first-child {
  margin-left: 7px;
}

.flex-tree-children {
  -webkit-flex-direction: row-reverse;
  -ms-flex-direction: row-reverse;
  flex-direction: row-reverse;
  margin: 3px;
  margin-left: 27px;
  min-width: 101px;
  max-width: 101px;
  min-height: 20px;
  min-height: 20px;
}

.flex-tree-content>.flex-tree-children:first-child {
  margin-top: 15px;
  margin-left: 7px;
}

.flex-tree-content2>.flex-tree-children:first-child {
  margin-top: 15px;
  margin-left: 7px;
}

.flex-tree-child-button {
  width: 16px;
  height: 16px;
  background-image: url('https://cdn2.iconfinder.com/data/icons/bwpx/icons/toggle_minus.gif');
  background-repeat: no-repeat;
  cursor: pointer;
  order: 2;
}

.flex-tree-child {
  text-align: center;
  width: 80px;
  height: 20px;
  background-color: GreenYellow;
  border-style: solid;
  border-width: 1px;
  color: black;
  margin-left: 5px;
  order: 1;
}

.flex-tree-close {
  line-height: 7px;
  width: 75px;
  height: 25px;
  cursor: pointer;
  margin: 3px;
}
<div class="flex-tree" style="left: 50px; top: 50px;">
  <div class="flex-tree-content">
    <div class="flex-tree-children" id="2">
      <div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
    <div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
    <div class="flex-tree-parent" id="8">
      <div class="flex-tree-children" id="8">
        <div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
      <div class="flex-tree-parent" id="19">
        <div class="flex-tree-children" id="19">
          <div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
        <div class="flex-tree-children" id="26">
          <a class="flex-tree-child" id="26">1,2,1,1</a></div>


      </div>
      <div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
      <div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
    </div>
    <div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
    <div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
    <div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
  </div>
  <div class="flex-tree-bottom">
    <button class="flex-tree-close">Close</button>
  </div>
</div>

<div class="flex-tree2" style="left: 400px; top: 50px;">
  <div class="flex-tree-content2">
    <div class="flex-tree-children" id="2">
      <div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
    <div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
    <div class="flex-tree-parent" id="8">
      <div class="flex-tree-children" id="8">
        <div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
      <div class="flex-tree-parent" id="19">
        <div class="flex-tree-children" id="19">
          <div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
        <div class="flex-tree-children" id="26">
          <a class="flex-tree-child" id="26">1,2,1,1</a></div>


      </div>
      <div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
      <div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
    </div>
    <div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
    <div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
    <div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
  </div>
  <div class="flex-tree-bottom">
    <button class="flex-tree-close">Close</button>
  </div>
</div>
5
tEhHoLLoW 27 अप्रैल 2017, 22:12

1 उत्तर

सबसे बढ़िया उत्तर

flex-shrink: 0 का उपयोग .flex-tree-parent पर करें

/* WorkPackage Treeview */

.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-bottom,
.flex-tree-parent,
.flex-tree-children,
.flex-tree-child-button {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-parent {
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.flex-tree {
  min-width: 240px;
  max-width: 245px;
  min-height: 180px;
  max-height: 180px;
  position: absolute;
  border-style: solid;
  border-width: 1px;
  z-index: 100;
}

.flex-tree2 {
  min-width: 240px;
  max-width: 245px;
  min-height: 380px;
  max-height: 380px;
  position: absolute;
  border-style: solid;
  border-width: 1px;
  z-index: 100;
}

.flex-tree-content {
  min-height: 150px;
  max-height: 150px;
  background-color: White;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  overflow-y: scroll;
}

.flex-tree-content2 {
  min-height: 350px;
  max-height: 350px;
  background-color: White;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  overflow-y: scroll;
}

.flex-tree-bottom {
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-height: 32px;
  background-color: Gray;
  border-bottom-style: solid;
  border-bottom-width: 1px;
}

.flex-tree-parent {
  margin-left: 20px;
  flex-shrink: 0;
}

.flex-tree-parent>.flex-tree-children:first-child {
  margin-left: 7px;
}

.flex-tree-children {
  -webkit-flex-direction: row-reverse;
  -ms-flex-direction: row-reverse;
  flex-direction: row-reverse;
  margin: 3px;
  margin-left: 27px;
  min-width: 101px;
  max-width: 101px;
  min-height: 20px;
  min-height: 20px;
}

.flex-tree-content>.flex-tree-children:first-child {
  margin-top: 15px;
  margin-left: 7px;
}

.flex-tree-content2>.flex-tree-children:first-child {
  margin-top: 15px;
  margin-left: 7px;
}

.flex-tree-child-button {
  width: 16px;
  height: 16px;
  background-image: url('https://cdn2.iconfinder.com/data/icons/bwpx/icons/toggle_minus.gif');
  background-repeat: no-repeat;
  cursor: pointer;
  order: 2;
}

.flex-tree-child {
  text-align: center;
  width: 80px;
  height: 20px;
  background-color: GreenYellow;
  border-style: solid;
  border-width: 1px;
  color: black;
  margin-left: 5px;
  order: 1;
}

.flex-tree-close {
  line-height: 7px;
  width: 75px;
  height: 25px;
  cursor: pointer;
  margin: 3px;
}
<div class="flex-tree" style="left: 50px; top: 50px;">
  <div class="flex-tree-content">
    <div class="flex-tree-children" id="2">
      <div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
    <div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
    <div class="flex-tree-parent" id="8">
      <div class="flex-tree-children" id="8">
        <div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
      <div class="flex-tree-parent" id="19">
        <div class="flex-tree-children" id="19">
          <div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
        <div class="flex-tree-children" id="26">
          <a class="flex-tree-child" id="26">1,2,1,1</a></div>


      </div>
      <div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
      <div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
    </div>
    <div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
    <div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
    <div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
  </div>
  <div class="flex-tree-bottom">
    <button class="flex-tree-close">Close</button>
  </div>
</div>

<div class="flex-tree2" style="left: 400px; top: 50px;">
  <div class="flex-tree-content2">
    <div class="flex-tree-children" id="2">
      <div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
    <div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
    <div class="flex-tree-parent" id="8">
      <div class="flex-tree-children" id="8">
        <div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
      <div class="flex-tree-parent" id="19">
        <div class="flex-tree-children" id="19">
          <div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
        <div class="flex-tree-children" id="26">
          <a class="flex-tree-child" id="26">1,2,1,1</a></div>


      </div>
      <div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
      <div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
    </div>
    <div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
    <div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
    <div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
  </div>
  <div class="flex-tree-bottom">
    <button class="flex-tree-close">Close</button>
  </div>
</div>
4
Michael Coker 27 अप्रैल 2017, 22:21
तेजी से मदद के लिए Thx, मैंने सब कुछ बढ़ने की कोशिश की लेकिन सिकुड़ने के बारे में नहीं सोचा :)
 – 
tEhHoLLoW
27 अप्रैल 2017, 22:23