Help align the css menu in the center. I tried everything, nothing comes out, maybe you can. Here is the code .

.hovermenu ul { font: 20px verdana; padding - left: 0; margin - left: 0; height: 20px; } .hovermenu ul li { list - style: none; display: inline; } .hovermenu ul li a { padding: 9px 0.5em; text - decoration: none; float: left; color: black; background - color: transparent; border: px solid transparent; } .hovermenu ul li a: hover { background - color: #1E90FF; } html>body .hovermenu ul li a:active{ /* эффект при наведении мыши */ border-style: solid; } 
  • Correct the code first, jsfiddle red highlights to you that all is not well with markup. separate css, html and js (if any) - there are input fields for each of them. And then indicate what you have tried. - Yura Ivanov
  • jsfiddle.net/qgxUA/1 Separated put the centr tag, tried to put in different places. It is only a little to the side moves away - Ilya

2 answers 2

Poorly separated. float: left - for a superfluous, you already have display:inline for li , everything will be in a line and so. After this, we need to center the contents of ul , add:

 .hovermenu {text-align:center} 

upd. or better:

 .hovermenu ul {text-align:center} 

see here

    A little corrected. That's what happened. With vertical alignment, I think you can handle =)

     <head> <style type="text/css">.hovermenu ul{ font: 20px verdana; padding-left: 0; margin-left: 0; height: 20px; } .hovermenu ul li{ list-style: none; display: inline; } .hovermenu ul li a{ padding: 9px 0.5em; text-decoration: none; color: black; background-color: transparent; border: px solid transparent; } .hovermenu ul li a:hover{ background-color:#1E90FF; } html>body .hovermenu ul li a:active{ /* эффект при наведении мыши */ border-style: solid; } </style> </head> <body style="background-image:url(http://s2.ipicture.ru/uploads/20120531/pbb8FT9l.jpg);background-repeat:repeat-x repeat-x"> <!-- Save for Web Slices (ВСЕЕЕЕЕЕЕЕЕЕЕ.psd) --> <head> <body style="color:Yellow; background-color:#FFFFFF "><div class="hovermenu"> <table style="height:100%;width:100%;"> <tr><td style="text-align:center;"> <ul> <li><a href="#">Мои лоты</a></li> <li><a href="#">Отзывы</a></li> <li><a href="#">Добавить в избранное</a></li> <li><a href="#">Задать вопрос</a></li> </ul> </td></tr> </table> </div> <!-- End Save for Web Slices --> </body> 
    • Thank you very much. If it's not a secret, what have you changed? - Ilya
    • chic. from the series "css - garbage, the tables - our everything!". -one. - Yura Ivanov