I have a PHP script that makes a "newsbox" (a HTML div
) for each news item I have in my database using while{
. The problem is that the CSS rules that are supposed to align each of these boxes are not being applied.
PHP/HTML:
<div class="bottomnews">
<?php
$gnewsq = "SELECT * FROM news";
$gnewsr = mysqli_query($mysqli,$gnewsq);
if ($gnewsr->num_rows > 0) {
// output data of each row
while($nrow = $gnewsr->fetch_assoc()) {
?>
<div class='newssquare'>
<div style=background-image:url(uploads/<?php echo "$nrow[pic])"; ?> />
<div style='padding-top:125px;'/>
<div class='newscaption'>
<a href='nyheder.php?a=<?php echo "$nrow[ID]"; ?>'><?php echo "$nrow[titel]" ?></a>
</div>
</div>
<?php
}
} else {
echo "EMPTY";
}
?>
CSS:
.bottomnews {
position: absolute;
width: 1050px;
height: auto;
}
The CSS rules for .bottomnews
aren't applying, but the CSS rules for other things like .newssquare
are. It's really odd, and any help is appreciated.