Click here to Skip to main content
14,328,292 members
Rate this:
Please Sign up or sign in to vote.
See more:
first of all i have web page with background of tree i want to check if the condition is true ( a = b )then show the apple picture if not do nothing how can i apply it using php


<style>
.containerdiv { float: left; position: relative; } 
.cornerimage { position: absolute; top: 555; right: 555; } 
</style>

<div class="containerdiv" style="width:100%;" >
    <img border="0" src="tree.jpg" style="width:100%;" >

  <img class="cornerimage" border="0" src="apple.jpg" style="width:10%;">

<div>


What I have tried:

<style> .containerdiv { float: left; position: relative; } .cornerimage { position: absolute; top: 555; right: 555; } </style> <div class="containerdiv" style="width:100%;" > <img border="0" src="tree.jpg" style="width:100%;" > <?php if (1 == 5){?> <img class="cornerimage" border="0" src="apple.jpg" style="width:10%;"> <?php } ?> <div>
Posted
Updated 4-Sep-18 15:48pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

To set background image for a div, use background-image[^]
<div class="containerdiv" style="width:100%;background-image:url('tree.jpg')">  <?php if (1 == 1){?> <img class="cornerimage" border="0" src="https://via.placeholder.com/350x150" style="width:10%;"> <?php } ?> </div>
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100