1

I just tested my code. It works fine on Chrome and Mozilla. But not in IE 8.

Problems with inline-block display:

  • The 3th block: the content is not vertically align
  • The 5th box: No hover submenu appeared.

see here: http://jsfiddle.net/evNjH/

    <style type="text/css">

html, body {
  margin: 0;
  padding: 0;
}

#navcontainer { padding: 0 5 20px 10px; }


ul#navlist {
  font-family: sans-serif;
  margin-left: 0;
  padding: 0;
}

ul#navlist li
{
  padding: 10px 5px 10px 5px;
  background-color: #EF634A;
}
ul#navlist > li
{
  height:38px; 
  line-height:38px;
}
ul#navlist li:hover
{
  color: #ffff00;
  background-color: #3E748A;
}
ul#navlist a
{
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  line-height:1.1;
  vertical-align: middle;
}


ul#navlist ul, ul#navlist li
{
  padding: 0 8px;
  margin: 0 8px;
  list-style-type: none;
  box-shadow: 8px 8px 12px #aaa;
}

ul#navlist > li:first-child {
  margin-left: 0;
}

ul#navlist li { float: left; 
}

ul#navlist li a
{
  color: #ffffff;

  //padding:10px;

  /*border: 1px #ffffff outset;
  height: 40px;*/ 
}


ul#navlist li:active
{
  color: #cccccc;
  background-color: #3E748A;
  border: 1px #ffffff inset;
  box-shadow: none;
}

ul#subnavlist { display: none; }
ul#subnavlist li { float: none;line-height:normal; }

ul#subnavlist li a
{
  padding: 0px;
  margin: 0px;
  height: 14px;
}

ul#navlist li:hover ul#subnavlist
{
  display: block;
  //display: inline-block;
  //display: table-cell;

  position: absolute;
  font-size: 8pt;
  padding-top: 5px;
  box-shadow: none;
}

ul#navlist li:hover ul#subnavlist li a
{
  display: block;
  width : 360;
  height : 100;
  border: none;
  padding: 2px;
}

ul#navlist li:hover ul#subnavlist li a:before { content: " >> "; }

a.white:link {color: #fff;}
a.white:active {color: #fff;}
a.white:visited {color: #fff;}
a.white:hover {color: #fff;}

</style>

and the html

<div id="navcontainer">
<ul id="navlist">
<li><a href="obs-geostrategique-sport1.php?cat=2">ACTUALITÉS</a></li>
<li><a href="obs-geostrategique-sport1.php?cat=5">ANALYSE</a></li>
<li><a href="obs-geostrategique-sport1.php?cat=1">PROGRAMME EUROPÉEN DE LUTTE <br>CONTRE LE TRUCAGE DE MATCHS</a></li>
<li><a href="obs-geostrategique-sport1.php?cat=3">COMMUNIQUÉ</a></li>

<li><a href="#">THEMATIQUES</a> 
<ul id="subnavlist">
    <li id="subactive"> <a href="obs-geostrategique-sport1.php?cat=4&id=1">Lutte contre la corruption</a></li>
    <li><a href="obs-geostrategique-sport1.php?cat=4&id=2">Evènements sportifs </a></li>
    <li><a href="obs-geostrategique-sport1.php?cat=4&id=3">Bonne gouvernance du sport</a></li>
    <li><a href="obs-geostrategique-sport1.php?cat=4&id=4">Economie du sport</a></li>
    <li><a href="obs-geostrategique-sport1.php?cat=4&id=5">Lutte contre le dopage</a></li>
    <li><a href="obs-geostrategique-sport1.php?cat=4&id=7">Lutte pour l'intégrité dans le sport</a></li>
</ul>
</li>
</ul>
</div> 
Colin Brock
  • 21,267
  • 9
  • 46
  • 61
user2718437
  • 97
  • 1
  • 5

1 Answers1

0

You have some errors in css, try

html, body {
    margin: 0;
    padding: 0;
}
#navcontainer {
    padding: 0 5px 20px 10px;
}
ul#navlist {
    font-family: sans-serif;
    margin-left: 0;
    padding: 0;
}
ul#navlist li {
    padding: 10px 5px 10px 5px;
    background-color: #EF634A;
}
ul#navlist > li {
    height:38px;
    line-height:38px;
}
ul#navlist li:hover {
    color: #ffff00;
    background-color: #3E748A;
}
ul#navlist a {
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    line-height:1.1;
    vertical-align: middle;
}
ul#navlist ul, ul#navlist li {
    padding: 0 8px;
    margin: 0 8px;
    list-style-type: none;
    box-shadow: 8px 8px 12px #aaa;
}
ul#navlist > li:first-child {
    margin-left: 0;
}
ul#navlist li {
    float: left;
}
ul#navlist li a {
    color: #ffffff;
}
ul#navlist li:active {
    color: #cccccc;
    background-color: #3E748A;
    border: 1px #ffffff inset;
    box-shadow: none;
}
ul#subnavlist {
    display: none;
}
ul#subnavlist li {
    float: none;
    line-height:normal;
}
ul#subnavlist li a {
    padding: 0px;
    margin: 0px;
    height: 14px;
}
ul#navlist li:hover ul#subnavlist {
    display: block;
    position: absolute;
    font-size: 8pt;
    padding-top: 5px;
    box-shadow: none;
}
ul#navlist li:hover ul#subnavlist li a {
    display: block;
    width : 360;
    height : 100;
    border: none;
    padding: 2px;
}
ul#navlist li:hover ul#subnavlist li a:before {
    content:" >> ";
}
a.white:link {
    color: #fff;
}
a.white:active {
    color: #fff;
}
a.white:visited {
    color: #fff;
}
a.white:hover {
    color: #fff;
}

Errors

  • 6 #navcontainer padding only 0 can be a length. You must put a unit after your number : 0 5 20px 10px
  • 46 ul#navlist li a Parse Error //padding:10px;
  • 70 ul#navlist li:hover ul#subnavlist Parse Error //display: inline-block;
  • 71 ul#navlist li:hover ul#subnavlist Parse Error //display: table-cell;
Sbml
  • 1,907
  • 2
  • 16
  • 26
  • the submenu for the last bloc is far away from the bloc... we can not select anything.and the height is big – user2718437 Aug 29 '13 at 14:16
  • Probably you need a conditional stylesheet with some css changes for IE – Sbml Aug 29 '13 at 14:52
  • Tried to put \9 after some line but no change. I really need your help. Thanks Example: ul#subnavlist { display: none; margin-top:2em\9 ; } – user2718437 Aug 30 '13 at 09:01
  • View the accepted answer http://stackoverflow.com/questions/5635829/ie8-css-hack-best-method – Sbml Aug 30 '13 at 09:39