1

I created a php file that parses a .txt file to display real estate ads.

I used a foreach loop for the arrays and everything works well except in IE7. The text size increases after each array in IE7. This is all within in a joomla article and the appropriate php file is included using the Sourcerer plugin.

I changed the font-size from % to em in the appropriate css files, but that did not work. I tried to use zoom:1 in the divs but I already have a position:absolute within the containg div and that did not work either.

The foreach loop:

foreach($results as $book){
echo '<div id="annonces">';
echo '<div id = "annoncetext">';
echo '<p class="annonces_title"> ' . $book[2]. '</p>';
echo '<p class="annonces_ref">' . $book[3]. ' m<sup>2</sup> - ' . $book[4] . ' pièces - ' . $book[5] . ' chambres<br>';
echo '<p class="annonces_prix">Prix : '  . $book[6]. ' €&lt;br></p>';
echo '<p class="annonces_description">' .  $book[8]. '<br><br>';
'</div></div>';

And some of the relevant css:

p.annonces_title{ 
    font-size: 1.75em;
    font-weight:normal;
    line-height:28px;
    padding: 5px 10px 1px 0px;
    margin: 0px 4px 13px 0;
    letter-spacing:0px;
    text-transform: uppercase;
    color:#fff;
}
p.annonces_prix{ 
    font-size:1.3em;
    line-height:18px;
    padding:8px 0 4px 0;
    margin-bottom:8px;
    color:#fff;
    font-weight:normal;
    text-transform:none;
}

#annonces {
    margin-left:0;
    margin-top:30px;
    width:1080px;
    font-size-adjust:none;
    min-height:500px;
    position:relative;
    background-image:url(filet-annonces.jpg);
    background-position:bottom;
    background-repeat:no-repeat;
}

#annoncetext {
    position:absolute;
    top:0;
    width:340px;    
}

To finish, not only do the text-size increase with each new ad, but the footer, which is not in the loop is also enlarged. Here is a link to the page. http://www.lagrandiere-immobilier.fr/espace-location/nos-offres-de-location The phenomena can be observed in Adobe BrowserLab.

4

1 回答 1

1

您在行尾缺少结束</p>标签

echo '<p class="annonces_ref">' . $book[3]. ' m<sup>2</sup> - ' . $book[4] . ' pièces - ' . $book[5] . ' chambres<br>';

还有这里:

echo '<p class="annonces_description">' .  $book[8]. '<br><br>';

因此,您的 HTML 可能无法正确呈现。

另外,在循环中不应该使用 ID,因为 ID 属性应该是唯一的,所以我建议将其更改为类属性,或者通过添加 ID 后缀使其唯一。

于 2012-06-20T12:02:19.220 回答