Reputation: 3293
I want to show a png file in background of a div. I have this CSS style for put it in the correct place. I'v tested directly in my HTML and the style works properly. I't doesn't work wen I use php variable.
<?php
if ($RScoluna1['nova'] == 1){
$style = "background-image:url(layout/nova.png); background-repeat:no-repeat; background-position: 220px 0;";
} else {
$style = "";
}
?>
<div class="<?php echo $row_RScoluna1['class_cor']; ?>" style="<?php echo $style; ?>">
Upvotes: 0
Views: 193
Reputation: 1115
If you copy pasted
background-image:url(layout/nova.png)
from a css file, then you should fix the path accordingly to the position of the script.
In example:
background-image:url("../css/layout/nova.png");
I hope it helps.
Upvotes: 1