元素上的宽度相等

时间:2014-05-02 08:00:18

标签: javascript jquery html css

这里我有两个盒子,看起来像这样

<div class="dataViewBox">
  <div class="dataViewBox-Download">
    <div class="dataViewBox-DownloadLink">
      <span class="dataViewBox-Hashes"></span>
    </div>

    <div id="testblock0h" class="dataViewBox-HideShowButton" onclick="magicmushrooms('testblock0')">Show</div>

    <div class="dataViewBox-Name">SomeName</div>
  </div>

  <div id="testblock0" class="dataViewBox-BottomBorder">
    <div id="test0" class="dataViewBox-Data toggleable Text">
        <span>this is just a test to show the the box can expand and be alot more bigger then it first was</span>
    </div>
  </div>
</div>


<div class="infoViewExpirein">
  <div id="infoViewExpireinTime">Build this up to be bigger then the box................................</div>
</div>

<div class="dataViewBox">
  <div class="dataViewBox-Download">
    <div class="dataViewBox-DownloadLink">
      <span class="dataViewBox-Hashes"></span>
    </div>

    <div id="testblock1h" class="dataViewBox-HideShowButton" onclick="magicmushrooms('testblock1')">Show</div>

    <div class="dataViewBox-Name">SomeName</div>
  </div>

  <div id="testblock1" class="dataViewBox-BottomBorder">
    <div id="test1" class="dataViewBox-Data toggleable Text">
        <span>See how this box fallows the other one when you open it, and same when you close it, it always has equal width</span>
    </div>
  </div>
</div>


<div class="infoViewExpirein">
  <div id="infoViewExpireinTime">Build this up to be bigger then the box................................</div>
</div>

所有的代码都太多了,不能在这里发布,但我有两个盒子,代码现在就像现在一样,但问题是我不喜欢我如何解决这个问题,如果你打开一个盒子而你&# 39;看到另一个是免费的和相同的大小,它应该是这样的想法。因此页面上的所有元素始终是对称的。它只是只有你有&#34; display:table&#34;我试图找到另一种方法来做同样的结果,当你试图在所有东西上获得相同的宽度时它总是很难,但是做到这一点的方式CSS / JavaScript并不重要。所以问题是我可以得到相同的结果whitout&#34; display:table&#34;?

链接:JsFiddle

/ Slaktarn

0 个答案:

没有答案