English 中文(简体)
CSS Centering Issue for Navigation Menu
原标题:CSS Centering Issue for Navigation Menu

我需要一些中心编码帮助。 我一直试图把这一航海菜单放在一页上,无论我做什么,我都无法工作。 我尝试了隔.、边 margin、文 text:cent子和零件。 留在左边的人仍然多于右边。

http://i132.photobucket.com/albums/q38/blacktiphunter/center.jpg”rel=“nofollow”

我确信,它非常简单,但我看不出我做错做什么?

www.un.org/Depts/DGACM/index_spanish.htm 页: 1

Any help is greatly appreciated!

最佳回答

首先添加<代码>overflow:hidden,#nav, #nav ul到明确的浮动。 之后添加<代码>margin:0 auto。 但是,这总是需要固定的宽度,例如:width:760px。 因此,新的核心是:

#nav, #nav ul {
    list-style: none outside none;
    margin: 0 auto;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 760px;
    z-index: 30;
}
问题回答

如果你删除,

http://www.ohchr.org。

它的中心点。

Test/em>

中央安全局的布局有时可能是头痛的线。 在火ox中使用弹ome或

You need to specify the exact width of the MainMenu div and set his left-right margin to auto if you want to reach a correct centered layout.

确切的宽度为780px (150px * 5 (5link each row) + 10px * 2(10px左+10px右边)+2px * 5(每公升右边)。

采用这些方法:

#mainMenu {
    background: none repeat scroll 0 0 #000000;
    border: 10px solid #000000;
    color: #FFFFFF;
    display: block;
    margin: 0 auto;
    padding: 0;
    text-align: center;
    width: 780px;
}

修女区





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签