Bonjour à tous,

Je tente en ce moment de faire mon propre template de menu horizontal full CSS. Je suis en bon chemin mais je butte sur problème pour centrer ma barre de navigation.

Je voudrais que mes boutons soient centrés dans ma barre, mais je n'y arrive pas. En fait mon premier <ul> prend toute la longueur de la barre de navigation et je ne sais pas comment centre les <li> contenus avec le display:inline-block.

Bref, j'ai essayé plusieurs solutions en vain...

Voici mon code html:
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<div class="main">
    <div class="barre">
        <ul class="ulParent">
            <li><a class="liCatA" href="#">Cat&eacute;gorie 1</a>
                <ul class="ulEnfant">
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 1.1</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 1.2</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 1.3</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 1.4</a></li>
                    <li class="liSubCatLast"><a class="liSubCatALast" href="#">Sous-cat&eacute;gorie 1.5</a></li>
                </ul><!-- .ulEnfant -->        
            </li><!-- .liCat -->
            <li><a class="liCatA" href="#">Cat&eacute;gorie 2</a>
                <ul class="ulEnfant">
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 2.1</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 2.2</a></li>
                    <li class="liSubCatLast"><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 2.3</a></li>
                </ul><!-- .ulEnfant -->        
            </li><!-- .liCat -->
            <li><a class="liCatA" href="#">Cat&eacute;gorie 3</a>
		        <ul class="ulEnfant">
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.1</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.2</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.3</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.4</a></li>
                    <li><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.5</a></li>
                    <li class="liSubCatLast"><a class="liSubCatA" href="#">Sous-cat&eacute;gorie 3.6</a></li>
                </ul><!-- .ulEnfant -->        
            </li><!-- .liCat -->
            <li><a class="liCatA" href="#">Cat&eacute;gorie 4</a>
            </li><!-- .liCat -->
        </ul><!-- .ulParent -->
    </div><!-- .barre -->
</div><!-- .main -->

et le css qui va avec:
Code CSS : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@charset "utf-8";
/* CSS Document */
body { color:#000; background:#CCC; width:100%; }
 
.main { 
	background-color:#999;
	width:980px;
	height:600px;
	margin:0 auto;
}
.barre { 
	width:980px; 
	height:50px;
	margin-top:40px; 
	margin-left:0 auto; 
	margin-right:0 auto; 
	background-color:#026DA8; 
	vertical-align:middle;
	position:relative;
	color:#FFF;
}
.barre ul {
	list-style-type:none; 
	margin:0 auto; 
	clear:both; 
	line-height:50px;
	width:970px;
}
.barre ul li {
	line-height:50px; 
	padding:0 12px;
	display:block;
	float:left;
	width:150px;
	position:relative;
	text-align:center;
	font-family:Verdana, Geneva, sans-serif;
	font-size:0.9em;
}
.barre ul li:hover {
	background-color:#026DA8;
}
.barre ul li a.liCatA {
	width:150px;
	line-height:49px;
	height:49px;
	text-align:center;
	display:block;
	margin:0;
	padding:0;
	color:#FFF;
	text-decoration:none;
	font-family:Verdana, Geneva, sans-serif;
	font-size:0.9em;
}
.barre ul li:hover a.liCatA {
	background-color:#0283CA;
	width:150px;
	line-height:49px;
	height:49px;
	text-align:center;
	display:block;
	margin:0;
	padding:0;
	color:#FFF;
	text-decoration:underline;
}
.barre ul li:hover ul li a.liSubCatA {
	background-color:#0283CA;
	width:150px;
	line-height:49px;
	height:49px;
	text-align:center;
	display:block;
	margin:0;
	padding:0;
	color:#FFF;
	text-decoration:none;
}
.barre ul li:hover ul li.liSubCatLast a:hover {
	background-color:#038AD5;
	text-decoration:underline;
}
.barre ul li ul li.liSubCatLast {
	background-color:#026DA8;
	width:150px;
	line-height:49px;
	height:49px;
	text-align:center;
	display:block;
	margin-bottom:13px;
	padding:0;
	color:#FFF;
	text-decoration:none;
}
.barre ul li:hover ul li.liSubCatLast a {
	background-color:#0283CA;
	width:150px;
	line-height:49px;
	height:49px;
	text-align:center;
	display:block;
	margin:0;
	padding:0;
	color:#FFF;
	text-decoration:none;
}
.barre ul li:hover ul li.liSubCatLast a:hover {
	text-decoration:underline;
}
.barre ul li:hover ul li a:hover {
	text-decoration:underline;
}
.barre ul li:hover ul li a {
	font-family:Verdana, Geneva, sans-serif;
	font-size:0.85em;
	text-decoration:none;
}
.barre ul li:hover liCatA {
	background-color:#0283CA;
	border-bottom:1px solid #00F; 
	display:block;
	margin:0;
	padding:0;
}
.barre ul li ul {
	list-style-type:none; 
	margin:0; 
	padding:0;
	clear:both; 
	line-height:50px;
	width:150px;
	display:none;
	background-color:#026DA8;
}
.barre ul li ul li {
	line-height:50px; 
	display:block;
	padding:0; 
	width:150px;
}
.barre ul li:hover {
	cursor:pointer;
}
.barre ul li:hover ul { 
	display:block;
}
.barre ul li:hover ul li a {
	color:#FFF;
	text-decoration:none;
}

Avez vous une idée de ce qui ne va pas dans mon code?

Cordialement