Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.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 CSS水平居中时的固定位置_Html_Css - Fatal编程技术网

Html CSS水平居中时的固定位置

Html CSS水平居中时的固定位置,html,css,Html,Css,我在html中的一个元素上有以下css。它使图像水平居中,但不在我需要的页面底部。如何更改此css以使其水平居中,但使其位置:固定在底部 background: url(loginv1.png)50% 50% no-repeat; background-size: 75px 25px; height: 40px; width: 120px; display: block; margin: 0 auto; 背景定位格式为: background: url("...") horizontal ve

我在html中的一个元素上有以下css。它使图像水平居中,但不在我需要的页面底部。如何更改此css以使其水平居中,但使其位置:固定在底部

background: url(loginv1.png)50% 50% no-repeat;
background-size: 75px 25px;
height: 40px;
width: 120px;
display: block;
margin: 0 auto;

背景定位格式为:

background: url("...") horizontal vertical;
因此,请按以下方式指定您的背景:

background: url("loginv1.png") center bottom no-repeat;
background-size: 75px 25px;
下面是一个例子。

试试这个:

background: url("loginv1.png") center bottom no-repeat;
这将使背景图像水平放置在中心,垂直放置在底部


您希望长方体水平居中并固定在底部吗?
div {
  background: url(http://snag.gy/z01qo.jpg) 50% 50%/75px 25px no-repeat;
  height:40px;
  width:120px;
  position:fixed;
  bottom:0;
  left:50%;
  margin-left:-60px;
}