douchun9719 2014-05-08 19:06
浏览 12

如何更接近表单提交按钮

I have the following scripts placed in my PHP page:

echo "The file has been successfully read!";
echo "<br>";
echo "<br>";
echo "<form action='displaypurchase.php' method='post' target='_blank' enctype='multipart/form-data'>";
echo "<input type='hidden' name='Password' value='" . $_POST['Password'] . "'>";
echo "<input type='submit' name='displaypurchase' value='Purchases'>";
echo "</form>";
echo "<br>";

echo "<form action='displaygamebucks.php' method='post' target='_blank' enctype='multipart/form-data'>";
echo "<input type='hidden' name='Password' value='" . $_POST['Password'] . "'>";
echo "<input type='submit' name='displaygamebucks' value='Gamebucks'>";
echo "</form>";
echo "<br>";

echo "<form action='main.php' method='post' enctype='multipart/form-data'>";
echo "<input type='hidden' name='Password' value='" . $_POST['Password'] . "'>";
echo "<input type='submit' name='returntomain' value='Back to main'>";
echo "</form>";
echo "<br>";

The page look's like this:

http://s16.postimg.org/6afeiln85/Capture.png

As you can see, the form buttons are far from each other. I wanted them to align vertically and closer to each other. How do I achieve his? I tried float but the result was a mess.

EDIT:

Here's what I have so far. I added CSS style inside the FORM tag as Kel suggested.

now I'm getting this:

http://s30.postimg.org/4fa5mxpxd/Capture2.png

It's almost there, as you can see it's already closed to each other, the only problem left is I want them positioned vertically, meaning from top to bottom. The picture shows they are positioned from top to bottom but each buttons are moving to the right. I needed the
tags since without it, the buttons would line up horizontally.

FINAL EDIT: Got it to work the way I want it to be. I don't know why I haven't thought of it before, but I used a table without borders, and it worked exactly as how I wanted it to be. Posting an answer to help others

  • 写回答

4条回答 默认 最新

  • dqq48152418 2014-05-08 19:15
    关注

    Use float inside a div

     .rows
     {
      float:left;
     }
    
       <div>The file has been successfully read!</div>
      <div class="rows">
      <form action='displaypurchase.php' method='post' target='_blank' enctype='multipart/form-data'>
     <input type='hidden' name='Password' value=''>
     <input type='submit' name='displaypurchase' value='Purchases'>
    </form>
     </div>
    
       <div class="rows">
    
     <form action='displaygamebucks.php' method='post' target='_blank' enctype='multipart/form-data'>
     <input type='hidden' name='Password' value=''>
     <input type='submit' name='displaygamebucks' value='Gamebucks'>
    </form>
     </div>
    <div class="rows">
    <form action='main.php' method='post' enctype='multipart/form-data'>
    <input type='hidden' name='Password' value=''>
    <input type='submit' name='returntomain' value='Back to main'>
    </form>
    </div>
    

    Demo

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制