how to indent html output using CSS -


i using php loop through array , return results, each result being displayed along html code. right now, achieve indent using div tag , setting margin so:

for output 1:

<div style='height: 20px;margin-left: 60px;'>

for output 2:

<div style='height: 20px;margin-left: 110px;'>

enter image description here

the issue method of setting margin each output relies on criteria match criteria doesnt match , indentation ruined.

so there way using css or other way increase indent each output rather having specify fixed 1 ?

apologies if not being clear enough hoping can understand asking, otherwise let me know , try clarify more.

here sample code:

foreach ($data[0] $data) {     if ($data == a) {         echo "<div style='margin-left: 0px; '><img src='img/server_s.png' style='float: left;'></div>";     } elseif ($data == b) {         echo "<div style='margin-left: 60px;'><img src='img/link.png' style='clear: left;'></div>";     } elseif ($data == c) {         echo "<div style='margin-left: 110px;'><img src='img/link.png' style='clear: left;'></div>";     } } 

hope work you

$a=0;     foreach ($data[0] $data) {            if ($data == a) {     echo "<div style='margin-left: ".$a."px; '><img src='img/server_s.png' style='float: left;'></div>"; } elseif ($data == b) {     echo "<div style='margin-left: ".$a."px;'><img src='img/link.png' style='clear: left;'></div>"; } elseif ($data == c) {     echo "<div style='margin-left: ".$a."px;'><img src='img/link.png' style='clear: left;'></div>"; }   $a=$a+60;     } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -