繁体   English   中英

CSS-删除循环表单按钮之间的空间

[英]CSS - removing space between looped form buttons

*编辑以包括屏幕截图

我有一个使用PHP循环播放的表单,正在尝试删除每个提交按钮之间的空格。 出于美学原因,我希望能够精确地设置它们之间的空间。 有人可以为我如何实现这一目标提供一些见解吗?

positionText类似乎对某些人有帮助,而我似乎无法获得display:none不会产生任何影响。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
<style>
    .positionText {
        line-height: 0%;
        }
</style>
<body>
<div class="positionText">
<?php 

ini_set('display_errors',1);  error_reporting(E_ALL);

$result = file_get_contents('php://input');

require_once 'IRCconfig.php';

$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
    if ($connection->connect_error) die($connection->connect_error);

$DATE = empty($result) ? date('Y-m-d') : $result;
    {   
        $query  = "SELECT * FROM CLIENT_CHECKIN WHERE DATE(DATE)='$DATE' ORDER BY F_NAME ASC";
        $result = $connection->query($query);

        if (!$result) die ("Database access failed: " . $connection->error);

        $rows = $result->num_rows;
    }

for ($j = 0 ; $j < $rows ; ++$j)
    {
        $result->data_seek($j);
        $row = $result->fetch_array(MYSQLI_NUM);

        echo <<<_END
        <pre>
        <form class="clientSubmit" name="clientSubmit" action="IRCpopulatecheckin.php" method="POST">
        <input type="hidden" name="DATE" value="$row[0]">
        <input type="hidden" name="F_NAME" value="$row[1]">
        <input type="hidden" name="M_NAME" value="$row[2]">
        <input type="hidden" name="L_NAME" value="$row[3]">
        <input type="submit" name="dailyClient" value="$row[1] $row[2] $row[3]">
        </form> 
        </pre>
_END;
    }

?>
</div>
<body>

</html>

样本输出

您可以使用CSS选择提交按钮本身。

例如:

.positionText [type="submit"]{ margin-top: -2px;}

您也可以使用

[type="hidden"]or.positionText input{}

如果要分别设置每个提交的样式,请尝试
:first-child() and :last-child()

您也可以使用
  :first-child()和:last-child() 
选择第一个和最后一个提交。

希望能有所帮助。

由于formpre是块类型,因此您需要在CSS中添加一个空白:0。

pre,form{margin: 0}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM