2014-10-20 16 views
25

फ़ायरफ़ॉक्स नाइटली (35.0 ए 1) की नवीनतम (?) रिलीज के बाद से मुझे text-overflow: ellipsis 10 के साथ एक फ्लेक्सबॉक्स कंटेनर के अंदर एक समस्या का सामना करना पड़ रहा है, प्रत्येक कॉलम 50% चौड़ा है।फ्लेक्सबॉक्स कंटेनर में एलिप्सिस

डेमो:

.container { 
 
    width: 300px; 
 
    background: red; 
 
} 
 

 
.row { 
 
    display: flex; 
 
    flex-direction: row; 
 
    flex-wrap: wrap; 
 
} 
 

 
.column { 
 
    flex-basis: 50%; 
 
} 
 

 
.column p { 
 
    background: gold; 
 
    
 
    /* Will not work in Firefox Nightly 35.0a1 */ 
 
    text-overflow: ellipsis; 
 
    overflow: hidden; 
 
    white-space: nowrap; 
 
}
<div class="container"> 
 
    <div class="row"> 
 
    <div class="column"> 
 
     <p>Captain's Log, Stardate 9529.1: This is the final cruise of the starship Enterprise under my command. This ship and her history will shortly become the care of another crew. To them and their posterity will we commit our future. They will continue the voyages we have begun and journey to all the undiscovered countries boldly going where no man, where no one has gone before.</p> 
 
    </div> 
 
    <div class="column"> 
 
     <p>Captain's Log, Stardate 9529.1: This is the final cruise of the starship Enterprise under my command. This ship and her history will shortly become the care of another crew. To them and their posterity will we commit our future. They will continue the voyages we have begun and journey to all the undiscovered countries boldly going where no man, where no one has gone before.</p> 
 
    </div> 
 
    </div> 
 
</div>

रात में पाठ अपने कंटेनर के बाहर रिसाव हो जाएगा, और अंत में ... नहीं जोड़ी। क्रोम और फ़ायरफ़ॉक्स स्थिर में यह इरादे के रूप में काम करता है।

+0

पर webkist यह ठीक लग रहा है, लेकिन अगर आप पार ब्राउज़र काम कर अपने समाधान की जरूरत है, जैसे http एक जे एस समाधान का उपयोग करने पर विचार करें: // dotdotdot .frebsite.nl/ – GibboK

+1

यह प्रश्न डुप्लिकेट के रूप में चिह्नित किया गया है, लेकिन क्या डुप्लिकेट? मेरा मानना ​​है कि यह [यह एक] है (http://stackoverflow.com/questions/12022288/how-to-keep-a-flex-item-from-overflowing-due-to-its-text), लेकिन मुझे वर्तमान लगता है धागा पढ़ने के लिए आसान है। – Tibo

उत्तर

51

अंत में फ़ायरफ़ॉक्स नाइटली में हालिया परिवर्तनों को ट्रैक किया गया। लंबी कहानी छोटी, को .column चयनकर्ता पर सेट करने से यह अपेक्षा के अनुसार काम करेगा।

एक और व्यापक उत्तर here पाया जा सकता है। ध्यान दें:

"मूल रूप से: फ्लेक्स आइटम अपने न्यूनतम आंतरिक चौड़ाई नीचे हटना, जब तक आप स्पष्ट रूप से निर्दिष्ट मना कर देगा" "। उन पर" न्यूनतम-चौड़ाई "या" चौड़ाई "या" अधिकतम-चौड़ाई

काम कर समाधान:

.container { 
 
    width: 300px; 
 
    background: red; 
 
} 
 

 
.row { 
 
    display: flex; 
 
    flex-direction: row; 
 
    flex-wrap: wrap; 
 
} 
 

 
.column { 
 
    /* This will make it work in Firefox >= 35.0a1 */ 
 
    min-width: 0; 
 
    flex-basis: 50%; 
 
} 
 

 
.column p { 
 
    background: gold; 
 
    text-overflow: ellipsis; 
 
    overflow: hidden; 
 
    white-space: nowrap; 
 
}
<div class="container"> 
 
    <div class="row"> 
 
    <div class="column"> 
 
     <p>Captain's Log, Stardate 9529.1: This is the final cruise of the starship Enterprise under my command. This ship and her history will shortly become the care of another crew. To them and their posterity will we commit our future. They will continue the voyages we have begun and journey to all the undiscovered countries boldly going where no man, where no one has gone before.</p> 
 
    </div> 
 
    <div class="column"> 
 
     <p>Captain's Log, Stardate 9529.1: This is the final cruise of the starship Enterprise under my command. This ship and her history will shortly become the care of another crew. To them and their posterity will we commit our future. They will continue the voyages we have begun and journey to all the undiscovered countries boldly going where no man, where no one has gone before.</p> 
 
    </div> 
 
    </div> 
 
</div>

संबंधित मुद्दे