मैंने दो टेबल बनाए हैं, और मैं पहले के आकार के आधार पर दाएं 3 कॉलम के width
सेट करना चाहता हूं। मैंने calc((100% - 200px)/3)
की कोशिश की लेकिन यह सभी ब्राउज़रों में काम नहीं करता है: फ़ायरफ़ॉक्स 40 विफल रहता है, IE11 विफल रहता है, और क्रोम 44 यह सही करता है। मैं यह कैसे कर सकता हूं ताकि calc()
सभी ब्राउज़रों में समझा जा सके? या मुझे बस इसे भूल जाना चाहिए?कैल्क() सीएसएस में कैल्क नहीं है, ब्राउज़र में अंतर
मैंने एक बहुत ही सरल संस्करण बनाया जो ठीक से विफल रहता है।
<table class="tableauTable">
<thead>
<tr class="tableauRow first">
<th colspan="3" rowspan="2" class="tableauCell first"><span class="xspTextComputedField">Objet - Acteurs</span>
</th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Julien GARDIN</span>
</th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Justine VINCLAIR</span>
</th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Marcel COMMAS</span>
</th>
</tr>
</thead>
<tfoot>
<tr class="tableauRow first">
<th colspan="3" header="" class="tableauCell first"></th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Julien GARDIN</span>
</th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Justine VINCLAIR</span>
</th>
<th class="tableauCell header col3"><span class="xspTextComputedField">Marcel COMMAS</span>
</th>
</tr>
</tfoot>
</table>
ही, calc()
साथ:
<table class="tableauTable">
<thead>
<tr class="tableauRow first">
<th colspan="3" rowspan="2" class="tableauCell first"><span class="xspTextComputedField">Objet - Acteurs</span>
</th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Julien GARDIN</span>
</th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Justine VINCLAIR</span>
</th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Marcel COMMAS</span>
</th>
</tr>
</thead>
<tfoot>
<tr class="tableauRow first">
<th colspan="3" header="" class="tableauCell first"></th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Julien GARDIN</span>
</th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Justine VINCLAIR</span>
</th>
<th class="tableauCell header col3x"><span class="xspTextComputedField">Marcel COMMAS</span>
</th>
</tr>
</tfoot>
सीएसएस:
.tableauTable {
width:100%;
border-spacing: 1px;
}
.tableauRow.first .tableauCell {
background: #d2d2d2 none repeat scroll 0 0 !important;
text-align: center;
}
.tableauCell.first {
width: 150px;
}
.tableauCell.col3 {
width: 30%;
}
.tableauCell.col3x {
width: calc(30%);
}
.tableauCell.first {
background: #d2d2d2 none repeat scroll 0 0 !important;
text-align: center;
}
.tableauCell {
background: #eee none repeat scroll 0 0;
border: 2px solid white;
color: black;
}
http://jsfiddle.net/sjefb/19vrf52o/
यह बताता है कि यह ब्राउज़र-संगतता समस्या नहीं है [हालांकि] (http://caniuse.com/#feat=calc) –
क्या आप "विफल" के माध्यम से थोड़ा और विशिष्ट हो सकते हैं? जैसा कि आप उम्मीद करते हैं यह लेआउट नहीं है? लेआउट अनदेखा हो जाता है? यह ब्राउज़र दुर्घटनाग्रस्त हो गया? Http://caniuse.com/#feat=calc के अनुसार, विभिन्न ब्राउज़रों को उप-पिक्सल को कैसे प्रबंधित किया जाता है, इसके कारण जारी किया जा सकता है। – GordonM
क्या आपने पहेली खोल दी? आप देखेंगे कि जब col3 चौड़ाई 30% पर सेट की जाती है, तो सभी ब्राउज़र सही तरीके से व्यवहार करते हैं, जबकि जब चौड़ाई कैल्क (30%) पर सेट होती है तो केवल क्रोम काम करता है। –