当margin和padding为零并使用jQuery时div容器之间的空白区域

时间:2014-04-11 18:26:45

标签: javascript jquery css html

我有这个结果。 enter image description here

查看jsfiddle上的实例。

http://jsfiddle.net/Ar5Ce/

我需要取出红色箭头指向的线条之间的水平空白区域。

谢谢!

HTML

<div style="margin-top:35;">
   <div style="min-height:55px;">
      <div data-role="none" class="font-info-title">No. Client:</div>
      <div data-role="none" class="font-info-bold-12">00000000</div>
      <div style="clear:both;"></div>
   </div>
   <div style="min-height:55px;">
      <div data-role="none" class="font-info-title">id SAM:</div>
      <div data-role="none" class="font-info">00000000</div>
      <div style="clear:both;"></div>
   </div>
   <div style="min-height:55px;">
      <div data-role="none" class="font-info-title">Nom:</div>
      <div data-role="none" class="font-info">--- ---</div>
      <div style="clear:both;"></div>
   </div>
   <div style="min-height:55px;">
      <div data-role="none" class="font-info-title">Téléphone:</div>
      <div data-role="none" class="font-info">000-000-0000</div>
      <div style="clear:both;"></div>
   </div>
   <div style="min-height:55px;">
      <div data-role="none" class="font-info-title">Adresse:</div>
      <div style="" data-role="none" class="font-info">---- -----</div>
      <div style="clear:both;"></div>
   </div>
</div>

2 个答案:

答案 0 :(得分:0)

定义与父div相同的min-height,或者应用&#39; inherit&#39;属性

 .font-info-title {
   text-align: right;
   color: #FFFFFF;   
   font-size: 45px;  
   font-weight: bold;
   margin: 0 0 0 0; 
   padding:0 0 0 0;
   width: 30%;
   background-color:#004963;
   float:left;
   min-height:inherit;
}

答案 1 :(得分:-1)

尝试使用Eric Meyer的css reset

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}