Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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


HTML
<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:

HTML
<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

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>
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900