Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 按钮的奇怪间距_Css - Fatal编程技术网

Css 按钮的奇怪间距

Css 按钮的奇怪间距,css,Css,我的按钮在这里有一个小小的CSS问题 第一个似乎是我的按钮间距,我不知道为什么。但是,如果单击+按钮添加更多表格,奇怪的间距消失了,它遵循我的输入类型按钮边距样式 如何解决这个问题?因为在处理内联元素时,空格基本上很重要。源代码中的用空格分隔;(由JS注入的)不是 有各种各样的解决方案,其中大多数都列在中(我建议检查所有的解决方案,而不仅仅是被接受的解决方案)。这些反过来又可以分为 1) “标记冲突”,删除元素之间的空白。可以这样做 <input type="button" class

我的按钮在这里有一个小小的CSS问题

第一个似乎是我的按钮间距,我不知道为什么。但是,如果单击+按钮添加更多表格,奇怪的间距消失了,它遵循我的输入类型按钮边距样式


如何解决这个问题?

因为在处理内联元素时,空格基本上很重要。源代码中的
用空格分隔;(由JS注入的)不是

有各种各样的解决方案,其中大多数都列在中(我建议检查所有的解决方案,而不仅仅是被接受的解决方案)。这些反过来又可以分为

1) “标记冲突”,删除元素之间的空白。可以这样做

  <input type="button" class="some_class"
/><input type="button" class="some_class"
/><input type="button" class="some_class" />
   <input type="button" class="some_class" /><!-- 
--><input type="button" class="some_class" /><!--
--><input type="button" class="some_class" />

。。。或者像这样

  <input type="button" class="some_class"
/><input type="button" class="some_class"
/><input type="button" class="some_class" />
   <input type="button" class="some_class" /><!-- 
--><input type="button" class="some_class" /><!--
--><input type="button" class="some_class" />

2) “样式折叠”-保留空白,但使其不可见。在缺少简单解决方案的情况下,通常需要围绕这些内联元素创建一些容器,并将其字体大小和行距设置为0

这种方法的缺点是必须为容器中的元素恢复这些属性


3) “浮动”-将所有内联元素转换为块,对其应用“浮动”样式。这样,空白也会在视觉上消失。

我有一个更好的解决方案

只需将“字体大小:0”添加到父标记“”,然后将“字体大小:13px”添加到输入按钮(类“.togPTbutton”)


我刚刚在你的代码和它的工作上尝试了上述方法。

啊,好的。没有办法通过代码来缓解这种情况?我喜欢HTML的视觉呈现方式:(嗯,有很多不同的解决方案(关于
,但实际上是同一个问题)。如果我不能使用浮动,我通常更喜欢
标记冲突
解决方案(当结束标记移动到开始标记的开头)。谢谢。我最终使用了注释解决方案。