shaikhasad / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Margin Bottom doesnt work on first paragraph #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure why but when i have multiple paragraphs the margin under the first one 
does not work.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PDF</title>
<style>
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, font, 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 {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
    font-family:Arial, Helvetica, sans-serif;
}

img {
    width: 812px;
}

#greybg {
    background-image: url("images/background2.jpg");
    background-position: 157px 87px;
    background-repeat: no-repeat;
    height: 750px;
    margin-left: 19px;
    margin-top: 49px;
    width: 790px;
}

#first-para {
margin-bottom: 25px;    
}

#greybg p {
    font-size: 14px;
    margin-bottom: 25px;
    width: 95%;
}

</style>
</head>

<body>
<img id="header" src="images/Header.jpg" alt="" />
<div id="greybg">

<p id="first-para">Thank you for your interest in  and sister company . We 
would like to take this
opportunity to provide a little more information about our operations and hope 
that we be able to assist you with
your project requirements</p>

<p>Our Fans are a leading manufacturer and supplier of ventilation equipment to 
the Building Services industry, offering
a comprehensive product range from small domestic fans to large diameter units 
for heavy industrial and commercial
applications. With experience in a wide variety of market applications such as 
new build and refurbishment housing,
NHS, local government and schools, commercial kitchens and specialist car park 
and emergency smoke ventilation we
are confident we can work with you to meet your project requirements.</p>

<p>We can combine in-house technical expertise, advanced manufacturing 
facilities and an
experienced workforce dedicated to meeting the highest production standards, to 
deliver quality air handling and
heat recovery equipment to your bespoke requirements every time.</p>

<p>Pblahblahblah blah blah blah blah blah</p>

<p>We look forward to working with you in the future</p>

<p>Yours Sincerely,</p>

<p></p></div>
</body>
</html>

Is my HTML, the CSS is included inside

Original issue reported on code.google.com by jase.wil...@gmail.com on 25 Mar 2011 at 9:43

GoogleCodeExporter commented 9 years ago
I think you're just hitting a cascade problem in your CSS. When I check with 
Firefox I see the same result. As a rule I always recommend placing generic 
styles at the top of your CSS and more specific ones further down (though it 
really depends on the desired cascade).

So to fix the padding on your document you might try the following:

#greybg p {
  font-size: 14px;
  margin-bottom: 25px;
  width: 95%;
}
#greybg p#first-para {
  margin-bottom: 25px;  
}

Original comment by eclecticgeek on 25 Mar 2011 at 6:15

GoogleCodeExporter commented 9 years ago
I marked invalid too soon. My advice still holds for the cascade, but there 
does appear to be a problem with the margin on the first paragraph.

Original comment by eclecticgeek on 25 Mar 2011 at 6:18

GoogleCodeExporter commented 9 years ago
This was a problem with the margin collapsing, this is fixed in the trunk.

Original comment by fabien.menager on 10 Apr 2011 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by eclecticgeek on 30 May 2013 at 5:15