Html problem

loktoy

Established
paano ko kaya ito igilid sa rightside nya mismo isasagad sa right nya ito dalawa na to ayaw ng style="text-align:right;"

<a href= 'admincommentdelete.php?id=<?php echo $id_comment ?>' style="text-align:right;" class = "btn-delete">Delete</a>
<a href= 'admincommentdelete.php?id=<?php echo $id_comment ?>' style="text-align:right;" class = "btn-delete">Update</a>

ito code ko

<div class="container col-md-9 mt-2 ">
<?php
$sql = mysqli_query($con, "SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM adminpost inner join registration on registration.user_id = adminpost.user_id ORDER BY date_created DESC") or dir (mysqli_error($scon));

while($post_row = mysqli_fetch_array($sql)){
$id_user = $post_row['username'];
$id_comment = $post_row ['comment_id'];
?>
<div class="comet">
<div><h6>&nbsp &nbsp <i class="fa fa-user-circle-o"></i>&nbsp <?php echo $id_user; ?> &nbsp &nbsp <i class="icon1 fa fa-hand-o-right" ></i> <a href=""><?php echo $post_row['title'];?></a>
<br>
<!-- date & time -->
<div class="date-time">&nbsp &nbsp
<?php
$days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $post_row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if($days > 0)
echo date('F d, Y - H:i:sa', $post_row['date_created']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
elseif($days == 0)
echo $days.' day ago';
?>
<!-- end -->

<img src="../img/hour.png" alt= "hour logo" style = "width:10px";>

<a href= 'admincommentdelete.php?id=<?php echo $id_comment ?>' class = "btn-delete">Delete</a>
<a href= 'admincommentdelete.php?id=<?php echo $id_comment ?>' style="text-align:right;" class = "btn-delete">Update</a>
</h6></div>
</div>


<?php }?>
 
Kung nais mong ilagay ang mga link sa kanan ng kanilang mga konteksto, maaari mong subukan ang sumusunod na mga pagbabago sa iyong code:

1. Tanggaling ang "style" attribute sa mga link:
HTML:
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>

2. I-wrap ang mga link sa isang div na may CSS na nagbibigay ng "text-align: right":
HTML:
<div style="text-align: right;">
   <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
   <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>
</div>

Dahil sa paglalagay ng mga link sa loob ng div na may "text-align: right;", ang mga link ay nasa kanan ng kanilang mga konteksto. Siguraduhin na ikaw ay nagtatapos ng mga div na tamang pagkakasunud-sunod upang maiwasan ang anumang isyu sa pagkaayos ng HTML.
 
Kung nais mong ilagay ang mga link sa kanan ng kanilang mga konteksto, maaari mong subukan ang sumusunod na mga pagbabago sa iyong code:

1. Tanggaling ang "style" attribute sa mga link:
HTML:
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>

2. I-wrap ang mga link sa isang div na may CSS na nagbibigay ng "text-align: right":
HTML:
<div style="text-align: right;">
   <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
   <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>
</div>

Dahil sa paglalagay ng mga link sa loob ng div na may "text-align: right;", ang mga link ay nasa kanan ng kanilang mga konteksto. Siguraduhin na ikaw ay nagtatapos ng mga div na tamang pagkakasunud-sunod upang maiwasan ang anumang isyu sa pagkaayos ng HTML.
bat ganun parang nsa ilalim sya ng output ko gusto ko is pantay lang sya sa output ko pero nasa right side sya

ito code ko updated

<div class="container col-md-9 mt-2 ">
<?php
$sql = mysqli_query($con, "SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM adminpost inner join registration on registration.user_id = adminpost.user_id ORDER BY date_created DESC") or dir (mysqli_error($scon));

while($post_row = mysqli_fetch_array($sql)){
$id_user = $post_row['username'];
$id_comment = $post_row ['comment_id'];
?>
<div class="comet">
<div><h6>&nbsp &nbsp <i class="fa fa-user-circle-o"></i>&nbsp <?php echo $id_user; ?> &nbsp &nbsp <i class="icon1 fa fa-hand-o-right" ></i> <a href=""><?php echo $post_row['title'];?></a>
<br>
<!-- date & time -->
<div class="date-time">&nbsp &nbsp
<?php
$days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $post_row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if($days > 0)
echo date('F d, Y - H:i:sa', $post_row['date_created']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
elseif($days == 0)
echo $days.' day ago';
?>
<!-- end -->

<img src="../img/hour.png" alt= "hour logo" style = "width:10px";>
<div style="text-align: right;">
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>
</div>
</h6></div>
</div>


<?php }?>
 
bat ganun parang nsa ilalim sya ng output ko gusto ko is pantay lang sya sa output ko pero nasa right side sya

ito code ko updated

<div class="container col-md-9 mt-2 ">
<?php
$sql = mysqli_query($con, "SELECT *, UNIX_TIMESTAMP() - date_created AS TimeSpent FROM adminpost inner join registration on registration.user_id = adminpost.user_id ORDER BY date_created DESC") or dir (mysqli_error($scon));

while($post_row = mysqli_fetch_array($sql)){
$id_user = $post_row['username'];
$id_comment = $post_row ['comment_id'];
?>
<div class="comet">
<div><h6>&nbsp &nbsp <i class="fa fa-user-circle-o"></i>&nbsp <?php echo $id_user; ?> &nbsp &nbsp <i class="icon1 fa fa-hand-o-right" ></i> <a href=""><?php echo $post_row['title'];?></a>
<br>
<!-- date & time -->
<div class="date-time">&nbsp &nbsp
<?php
$days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
$remainder = $post_row['TimeSpent'] % (60 * 60 * 24);
$hours = floor($remainder / (60 * 60));
$remainder = $remainder % (60 * 60);
$minutes = floor($remainder / 60);
$seconds = $remainder % 60;
if($days > 0)
echo date('F d, Y - H:i:sa', $post_row['date_created']);
elseif($days == 0 && $hours == 0 && $minutes == 0)
echo "A few seconds ago";
elseif($days == 0 && $hours == 0)
echo $minutes.' minutes ago';
elseif($days == 0)
echo $days.' day ago';
?>
<!-- end -->

<img src="../img/hour.png" alt= "hour logo" style = "width:10px";>
<div style="text-align: right;">
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
<a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>
</div>
</h6></div>
</div>


<?php }?>
Kung nais mong maipantay ang mga link sa output ngunit nananatiling nasa kanan, maaari mong subukan ang sumusunod na mga pagbabago sa iyong code:

1. Alisin ang "text-align: right;" style attribute mula sa div na may class na "comet":
HTML:
<div class="comet">
   <div>
      <h6>&nbsp &nbsp <i class="fa fa-user-circle-o"></i>&nbsp <?php echo $id_user; ?> &nbsp &nbsp <i class="icon1 fa fa-hand-o-right" ></i> <a href=""><?php echo $post_row['title']; ?></a></h6>
   </div>
   <br>
   <!-- date & time -->
   <div class="date-time">&nbsp &nbsp
      <?php
         $days = floor($post_row['TimeSpent'] / (60 * 60 * 24));
         $remainder = $post_row['TimeSpent'] % (60 * 60 * 24);
         $hours = floor($remainder / (60 * 60));
         $remainder = $remainder % (60 * 60);
         $minutes = floor($remainder / 60);
         $seconds = $remainder % 60;
         if ($days > 0)
            echo date('F d, Y - H:i:sa', $post_row['date_created']);
         elseif ($days == 0 && $hours == 0 && $minutes == 0)
            echo "A few seconds ago";
         elseif ($days == 0 && $hours == 0)
            echo $minutes . ' minutes ago';
         elseif ($days == 0)
            echo $days . ' day ago';
      ?>
      <!-- end -->
      <img src="../img/hour.png" alt="hour logo" style="width:10px";>
      <div style="text-align: right;">
         <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Delete</a>
         <a href='admincommentdelete.php?id=<?php echo $id_comment ?>' class="btn-delete">Update</a>
      </div>
   </div>
</div>

Sa pag-alis ng "text-align: right;" sa div na may class na "comet", ang mga link ay dapat maipantay na nasa output. Siguraduhin na ang ibang bahagi ng iyong HTML ay hindi nagdudulot ng anumang isyu sa pagkaayos ng mga elemento.
 

Similar threads

About this Thread

  • 3
    Replies
  • 352
    Views
  • 1
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
671
Guests online
821
Total visitors
1,492

Forum statistics

Threads
2,273,613
Posts
28,950,668
Members
1,235,861
Latest member
keesh143
Back
Top