Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

purecss pure-menu-item doesn't work properly

This menu code is the first example in http://purecss.io/menus/.

Yet it works bad :(

Each <li> item stays a screenful of distance one another. If you scroll down you see the other items.

But it works in the purecss.io/menus page. I don't know why.

(Here when you run it works fine too… You have to create an html document with this code, then it fails…)

<html>

<head>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css">
</head>

<body>
  <div class="pure-menu">
    <span class="pure-menu-heading">Yahoo Sites</span>

    <ul class="pure-menu-list">
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Flickr</a>
      </li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Messenger</a>
      </li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Sports</a>
      </li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Finance</a>
      </li>
      <li class="pure-menu-heading">More Sites</li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">Games</a>
      </li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">News</a>
      </li>
      <li class="pure-menu-item"><a href="#" class="pure-menu-link">OMG!</a>
      </li>
    </ul>
  </div>
</body>

</html>

I've seen that pure-menu-item has a height: 100%, which I think is a bit strange. Is this the problem?

like image 631
ijverig Avatar asked Mar 13 '15 21:03

ijverig


1 Answers

Your HTML is invalid, you need to declare a doctype, for example:

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
    <link href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css" rel="stylesheet" />
</head>
<body>
    <div class="pure-menu">
      <span class="pure-menu-heading">Yahoo Sites</span>

      <ul class="pure-menu-list">
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">Flickr</a>
        </li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">Messenger</a>
        </li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">Sports</a>
        </li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">Finance</a>
        </li>
        <li class="pure-menu-heading">More Sites</li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">Games</a>
        </li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">News</a>
        </li>
        <li class="pure-menu-item"><a href="#" class="pure-menu-link">OMG!</a>
        </li>
      </ul>
    </div>
</body>
</html>

See this page for more information on how to structure your HTML file.

like image 99
pschueller Avatar answered Nov 11 '22 17:11

pschueller