संपादित करें:
आज, हमें बस Flexbox का उपयोग करना चाहिए ।
पुराने उत्तर:
ठीक है, हालांकि मैंने font-size: 0;और not implemented CSS3 featureउत्तर दोनों को उलट दिया है, मैंने कोशिश की कि मुझे पता चले कि उनमें से कोई भी वास्तविक समाधान नहीं है ।
वास्तव में, मजबूत दुष्प्रभावों के बिना एक भी समाधान नहीं है।
फिर मैंनेinline-block अपने HTMLस्रोत से विभाजनों के बीच रिक्त स्थान (यह उत्तर इस तर्क के बारे में है) को हटाने का फैसला कियाJSP , इसे बदल दिया:
<div class="inlineBlock">
I'm an inline-block div
</div>
<div class="inlineBlock">
I'm an inline-block div
</div>
इसके लिए
<div class="inlineBlock">
I'm an inline-block div
</div><div class="inlineBlock">
I'm an inline-block div
</div>
यह बदसूरत है, लेकिन काम कर रहा है।
लेकिन, एक मिनट प्रतीक्षा करें ... क्या हुआ अगर मैं अंदर मेरे divs पैदा कर रहा हूँ Taglibs loops( Struts2, JSTL, आदि ...)?
उदाहरण के लिए:
<s:iterator begin="0" end="6" status="ctrDay">
<br/>
<s:iterator begin="0" end="23" status="ctrHour">
<s:push value="%{days[#ctrDay.index].hours[#ctrHour.index]}">
<div class="inlineBlock>
I'm an inline-block div in a matrix
(Do something here with the pushed object...)
</div>
</s:push>
</s:iterator>
</s:iterator>
यह बिल्कुल नहीं है कि सभी सामान को इनलाइन करना उचित नहीं है, इसका मतलब होगा
<s:iterator begin="0" end="6" status="ctrDay">
<br/>
<s:iterator begin="0" end="23" status="ctrHour"><s:push value="%{days[#ctrDay.index].hours[#ctrHour.index]}"><div class="inlineBlock>
I'm an inline-block div in a matrix
(Do something here with the pushed object...)
</div></s:push></s:iterator>
</s:iterator>
यह पठनीय नहीं है, मंटेन को समझना और समझना, आदि ...
मैंने जो समाधान पाया:
अगले एक की शुरुआत से एक div के अंत को जोड़ने के लिए HTML टिप्पणियों का उपयोग करें!
<s:iterator begin="0" end="6" status="ctrDay">
<br/>
<s:iterator begin="0" end="23" status="ctrHour"><!--
--><s:push value="%{days[#ctrDay.index].hours[#ctrHour.index]}"><!--
--><div class="inlineBlock>
I'm an inline-block div in a matrix
(Do something here with the pushed object...)
</div><!--
--></s:push><!--
--></s:iterator>
</s:iterator>
इस तरह आपके पास एक पठनीय और सही ढंग से इंडेंट कोड होगा।
और, एक सकारात्मक पक्ष प्रभाव के रूप में HTML source, हालांकि, खाली टिप्पणियों से प्रभावित होकर, सही ढंग से इंडेंट किया जाएगा;
चलो पहला उदाहरण लेते हैं। मेरी विनम्र राय में, यह:
<div class="inlineBlock">
I'm an inline-block div
</div><!--
--><div class="inlineBlock">
I'm an inline-block div
</div>
इससे बेहतर है:
<div class="inlineBlock">
I'm an inline-block div
</div><div class="inlineBlock">
I'm an inline-block div
</div>