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
Html CSS如何垂直对齐我的文本和文本颜色_Html_Css - Fatal编程技术网

Html CSS如何垂直对齐我的文本和文本颜色

Html CSS如何垂直对齐我的文本和文本颜色,html,css,Html,Css,这是我现在的输出 这是我想要的输出 我的编码: .buttons{ background-image:url("SlicingImage/button_unselect.png"); margin: none; height: 53px; width: 180px; text-transform:uppercase; text-align:center; position:relative; vertical-align:bottom; } HTML: <li class="butt

这是我现在的输出

这是我想要的输出

我的编码:

.buttons{
background-image:url("SlicingImage/button_unselect.png");
margin: none;
height: 53px;
width: 180px;
text-transform:uppercase;
text-align:center;
position:relative;
vertical-align:bottom;
}
HTML:

<li class="buttons">home</li>
主页
但一切都没有改变:(

一般提示:如果只是一个链接而不是一个段落,请始终给
行高
等于div height,以使文本在中间垂直对齐

此处将
行高:53px;
添加到类中

一般提示:如果只是一个链接而不是段落,请始终给
行高
等于div height可在中间垂直对齐文本

此处将
行高:53px;
添加到类中

垂直对齐:底部;
仅适用于表属性,如
表单元格
表行

因此:


您需要处理这个问题;这里有一个解释:

垂直对齐:底部;
仅适用于表属性,如
表单元格
表行

因此:

你需要玩这个游戏;这里有一个解释:

试试这个:

.buttons{
background-image:url("SlicingImage/button_unselect.png");
margin: none;
/*height: 53px;
width: 180px;*/
padding: 30px 30px;
text-transform:uppercase;
text-align:center;
position:relative;
vertical-align:bottom;
}
试试这个:

.buttons{
background-image:url("SlicingImage/button_unselect.png");
margin: none;
/*height: 53px;
width: 180px;*/
padding: 30px 30px;
text-transform:uppercase;
text-align:center;
position:relative;
vertical-align:bottom;
}

垂直对齐对于您要执行的操作不起作用

您需要使用线条高度或填充来解决此问题

我会先试试线的高度

   .buttons { line-height: 100px; }
并从代码中删除高度:53px。但相应地调整行高度

或者你也可以试试

   .buttons { padding-top: 16px; }

并相应地调整

垂直对齐对于您要执行的操作不起作用

您需要使用线条高度或填充来解决此问题

我会先试试线的高度

   .buttons { line-height: 100px; }
并从代码中删除高度:53px。但相应地调整行高度

或者你也可以试试

   .buttons { padding-top: 16px; }

并相应调整

根据按钮高度使用线条高度当按钮处于活动状态时背景图像的外观和位置看起来不同根据按钮高度使用线条高度当按钮处于活动状态时背景图像的外观和位置看起来不同