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;'>
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
Post a Comment