Christoph's answer शायद सामान्य मामले में सबसे अच्छा है, लेकिन मेरे मामले में, मैं पाठ सामग्री नहीं बल्कि कंटेनर चौड़ाई है, जो मुझे प्रवंचना की एक अतिरिक्त परत जोड़ने जानता था:
थोड़ा एचटीएमएल फेरबदल:
<div id="first" class="container">
<div><span>first_text_section</span></div>
</div>
<div id="second" class="container">
<div><span>second_text_section</span></div>
</div>
<div id="third" class="container">
<div><span>third_text_section</span></div>
</div>
और निम्नलिखित सीएसएस का उपयोग कर:
.container > div {
color: transparent; /* don't show the text-overflow content */
overflow: hidden;
height: 1em;
width: 100%;
}
/* use the actual text to get the measurement right for hiding */
#first > div { text-overflow: "first_text_section"; }
#second > div { text-overflow: "second_text_section"; }
#third > div { text-overflow: "third_text_section"; }
.container > div > span {
color: black; /* do show the span when possible */
}
फिर कंटेनर परिवर्तन की चौड़ाई के रूप में, पूरा टेक्स्ट या तो छिपा या दिखाया अनुप्रयोग है ropriately। यदि निहित पाठ एक से अधिक शब्द है, तो पाठ शब्द से छिपा शब्द है, इसलिए यह जानना कुछ है।
# विजेता की सामग्री क्या है और आप यह कैसे निर्धारित करते हैं कि यह क्लिप किया गया है? क्या यह पाठ, छवि, iframe ... है? –
@remibreton: मेरे विशिष्ट मामले में, यह सिर्फ पाठ है। – rampion