CSS按钮未对齐

时间:2017-12-28 13:27:02

标签: html css html-table

我想创建下表:https://fiddle.jshell.net/7zrmd2wa/

小提琴上的输出效果不错,但如果我自己主持,那么输出它,按钮不对齐。 https://imgur.com/a/byaM5

我用不同的浏览器测试过它。

我不明白为什么?我该如何解决?

4 个答案:

答案 0 :(得分:1)

添加此CSS以在所有单元格中获得垂直居中:

td {
  vertical-align: middle;
}

答案 1 :(得分:1)

添加以下内容,它应该可以解决问题。当我在单独的html文件上启动代码时,我能够重现您的问题

#table1 td form{
    display: inline;
}

#table1 td form{
    display: table-cell;
}

答案 2 :(得分:0)

尝试在样式表中添加:

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;

namespace StackOverFlowHelp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter the Amounts Separated By space : ");
            var listItems = Console.ReadLine();
            Console.Write("Enter the target : ");
            var target = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine();

            List<Int32> numbers = listItems.Split(' ').Select(x => Convert.ToInt32(x)).ToList();
            if (numbers.Count <= 1)
            {
                Console.WriteLine("The list must contain at-least 2 numbers");
            }
            else
            {
                var currentSum = numbers.Sum();
                if (currentSum == target)
                {
                    Console.WriteLine("SUM of List " + string.Join(" ", numbers) + " already matches the target " + target + ". No number has been removed.");
                }
                else if (currentSum < target)
                {
                    Console.WriteLine("SUM of List " + string.Join(" ", numbers) + " is smaller than the target " + target + ". No number can been removed.");
                }
                else
                {
                    numbers.Sort();
                    var incrementalSum = 0;
                    var qualifiedIndex = 0;
                    for (int i = 0; i < numbers.Count; i++)
                    {
                        incrementalSum += numbers[i];
                        if (incrementalSum == target)
                        {
                            /*Remove the numbers after index value*/
                            qualifiedIndex = i + 1;
                        }
                        else if (incrementalSum > target)
                        {
                            /*Remove the numbers from index value*/
                            qualifiedIndex = i;
                        }
                        if (qualifiedIndex > 0)
                        {
                            /*We are ready with our results*/
                            Console.WriteLine("SUM of List " + string.Join(" ", numbers.Take(qualifiedIndex)) + " is closest to the target " + target + ". Following number can been removed: " + string.Join(" ", numbers.Skip(qualifiedIndex).Take(numbers.Count - qualifiedIndex)));
                            break;
                        }
                    }
                    if (qualifiedIndex == 0)
                    {
                        Console.WriteLine("Could not find any number to remove.");
                    }
                }
            }
            Console.WriteLine();
            Console.WriteLine("Press Any Key to Exit.....");
            Console.Read();
        }
    }
}

尝试这种方式:jsfiddle edited

答案 3 :(得分:-1)

查看示例,除非您有一些额外的CSS,否则它应该可以正常工作。