Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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/9/google-cloud-platform/3.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_Text_Menu_Center - Fatal编程技术网

Html 将“我的菜单”的文本居中

Html 将“我的菜单”的文本居中,html,css,text,menu,center,Html,Css,Text,Menu,Center,我需要一些帮助集中在html css我的菜单 这是我的代码: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>OMFGuys Official Website</title> <link rel="shortcut icon" href="http://i.imgur.com/3k9U9Os.png"&

我需要一些帮助集中在html css我的菜单 这是我的代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>OMFGuys Official Website</title>
<link rel="shortcut icon" href="http://i.imgur.com/3k9U9Os.png">
</head>
<body background="Imgs/papBG.png">

<div id="header" align="center">
    <link rel="stylesheet" type="text/css" href="img.css" media="screen" />
    <img src="Imgs/banner.png" width="100%">
</div>

<div id='cssmenu'>
<link rel="stylesheet" type="text/css" href="menucss.css" media="screen" />
<ul>
   <li class='active'><a href='index.html'><span>Início</span></a></li>
   <li><a href='#'><span>Youtube</span></a></li>
   <li><a href='#'><span>Sobre Nós</span></a></li>
   <li><a href='#'><span>Contactos</span></a></li>
   <li class='last'><a href='#'><span>Loja do Fã</span></a></li>
</ul>
</div>

</body>
这是我得到的结果: 但我想要这样的东西:用油漆xD做的


是的,如果有人能帮我,我将非常感激。

cssmenu的宽度设置为自动。要使该部分居中,您需要将其设置为显式宽度,然后为其设置自动居中边距

例如:

#cssmenu ul{
    width:1024px;
    margin:0 auto;
}
如果你想让背景色覆盖整个页面的宽度,只需将UL放在一个div的内部,并为该div设置自动宽度

这里有一个更深入的JSFIDLE示例:

进行这些更改

#cssmenu ul {
  text-align: center;  // Add this
}

#cssmenu li {
    //display: block;  // Take this out
    display: inline-block; // Use Instead
    //float: left;  //Take this out
 }

提供更多信息。
#cssmenu ul {
  text-align: center;  // Add this
}

#cssmenu li {
    //display: block;  // Take this out
    display: inline-block; // Use Instead
    //float: left;  //Take this out
 }