2014-10-20 30 views
25

En son (?) Firefox Nightly sürümünden (35.0a1), text-overflow: ellipsis ile flex-direction: row numaralı bir kutuda her bir sütun% 50 genişliğinde bir sorunla karşılaşıyorum.Esnek kutu kapsayıcısındaki ellipsis

Demo:

.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>

Gecelik yılında metin kabı dışında sızıntı olur ve sonunda ... eklenemez. Chrome ve Firefox Sabit'te amaçlandığı gibi çalışır.

+0

: // dotdotdot .frebsite.nl/ – GibboK

+1

Bu soru kopyalandı, ancak neyi kopyalandı? Sanırım, bu [http://stackoverflow.com/questions/12022288/how-to-keep-a-flex-item-from-overflowing-due-to-its-text) ama şimdiki zamanı buluyorum. okumak için iş parçacığı daha basit. – Tibo

cevap

51

Bu, Firefox Nightly'deki son değişikliklere kadar takip edildi. min-width: 0'un .column seçicisine ayarlanmasıyla ilgili kısa, kısa bir süre beklendiği gibi çalışacaktır.

Daha kapsamlı bir yanıt here bulunabilir. Dikkat çekici:

"Temelde: esnek ürün açıkça belirtmedikçe, onların asgari içsel genişliği aşağıda küçülmeye reddedecektir ' ' üzerlerinde' min-width' veya 'genişlik' veya" max-width

çalışma çözeltisi:

ince görünüyor, ancak çapraz tarayıcı çalışan çözümünüzü gerekiyorsa, http gibi bir JS çözümlerini kullanarak düşünün lütfen webkist On

.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>

İlgili konular