我有div,它包含一個img元素,然後直接在下面是div元素,然後在下面是另一個img元素。img&a div之間的空白
我的問題:這些元素之間應該沒有垂直差距。但是會發生什麼情況是中間div & imgs(頂部&底部)之間存在10/20px的垂直間隙。
我該如何去除2個img元素之間的內部div &之間的垂直間隙?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/homepage.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
/* Test Specific */
/*Perform CSS Reset*/
html, body, div, form, fieldset, legend, label, img { margin: 0; padding: 0; } table { border-collapse: collapse; border-spacing: 0; } th, td { text-align: left; } h1, h2, h3, h4, h5, h6, th, td, caption { font-weight:normal; } img { border: 0; }
.pageBox { width: 700px; display: block; }
.pageBoxContent { background: url("images/pageBoxMid.png") repeat-y; background-color: red;
padding-right: 50px; padding-left: 50px; width: 700px; }
.pageBoxContent p { font-family:Calibri, "Myriad Pro", Serif; }
.pageBoxTop { background-color: blue; }
.pageBoxBottom { background-color: blue; }
-->
</style>
</head>
<body>
<div>
<div class="pageBox">
<img class="pageBoxTop" src="images/pageBoxTop.png" alt=""/>
<!-- Gap appears here on display -->
<div class="pageBoxContent">
<p class="subHeading">Upcoming Events</p>
<p>abcedefdfdgdf</p>
<p>abcedefdfdgdf</p>
<p>abcedefdfdgdf</p>
<p>abcedefdfdgdf</p>
</div>
<!-- Gap appears here on display -->
<img class="pageBoxBottom" src="images/pageBoxBottom.png" alt=""/>
</div>
<br/>
<br/>
</div>
</body>
</html>
謝謝,我得到是什麼導致它現在:) – Mack