Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.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
Html 向左居中浮动以进行快速搜索_Html_Css - Fatal编程技术网

Html 向左居中浮动以进行快速搜索

Html 向左居中浮动以进行快速搜索,html,css,Html,Css,我想为QuickSearch做几个问答,但运气不好。div与背景图像一起向左浮动 HTML <div class="l-row"> <div class="QuickSearch"> <div class="loop"></div> <form action=><div class="quickSearchInputName">xxx</div></form> </di

我想为QuickSearch做几个问答,但运气不好。div与背景图像一起向左浮动

HTML

<div class="l-row">
  <div class="QuickSearch">
    <div class="loop"></div>
    <form action=><div class="quickSearchInputName">xxx</div></form> 
  </div>
</div>

这里有一个固定大小的元素,所以我想你应该遵循经典:

.loop {
  width: 10px; height: 135px;
  ...
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -67px;
  /* taking into account that margin-right: 2px in the original ruleset */
  margin-left: -3px; 
}

检查(必须对其进行一些更改,使用普通颜色而不是图像作为背景)。

是否应该是
.l-row
,顺便说一句?当你说“中心div”时,你能说明你想要什么吗,至于其他方面呢?左浮动与边距相反:自动除法。不确定您是否对浮动感到困惑,或者只是不了解您需要什么。您好,这是
.l-row
div的用途?为什么这么复杂?更简单:
.l-row{width:942px;text align:center;}
@Stano:Changed.l-row但仍不居中。我希望背景图像:job-search-bg.jpg居中。对不起,把你们弄糊涂了。在l行前面放“.”之后也一样。我确实读过一些问答,并且都讲了关于边距:0到中心浮动:左,如果没有弄错的话。。。
.loop {
  width: 10px; height: 135px;
  ...
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -67px;
  /* taking into account that margin-right: 2px in the original ruleset */
  margin-left: -3px; 
}