CSS Dropdown UL LI A

时间:2015-09-13 00:41:40

标签: html css html-lists

因为我使用过CSS,所以需要一些帮助。

我试图让主力' Home'栏25%的屏幕。虽然我认为它受某种对齐问题的影响。

Here's the link to the source code

http://codepen.io/anon/pen/ZbbNqO?editors=110

哇,谢谢你们的反馈!我编辑了代码,我还有一些问题/错误和修复,你可以帮助。

任何想法为什么主菜单栏不是屏幕的宽度? (颜色仅供识别之用) 菜单栏1,2和3是否同时可见?

4 个答案:

答案 0 :(得分:5)

试试这个:#primary_nav_wrap {height: 25%;}

答案 1 :(得分:0)

如果您希望身高为25%,则:

body {
    /* ... */
    height:100vh;
}
#primary_nav_wrap {
    /* ... */
    height: 25%
}
#primary_nav_wrap>* {
    /* ... */
    height: 100%;
}

答案 2 :(得分:0)

http://codepen.io/damianocel/pen/BooevE?editors=110

无论屏幕大小如何,您都可以将高度设置为25%,请注意我只设置了高度并将" main"链接到那里,你并不准确地知道你希望整个导航如何看待以后。 无论哪种方式,无论如何,这个高度绝对是25%: - )

app.factory('foreCast', ['$http', function($http,$scope ) { 

var req = $http.jsonp("https://www.kimonolabs.com/api/c1ab8xnw?&apikey=api-key&callback=JSON_CALLBACK");
     req.success(function (data) { 
         req.rows =data.results.collection1;
          req.rand =req.rows[Math.floor(Math.random() * req.rows.length)];
              console.log(req.rand); 
                 //i want this results      
                                       });    
return req; //how can i return req.rand?

}]);

答案 3 :(得分:0)

HTML:

<div>
   <nav id="primary_nav_wrap">
      ...
   </nav>
</div>

CSS

div {
  height: 100vh;
}

div {
  position: absolute;
  top: 0; bottom:0; right:0; left:0;
}

并完成

nav {
  height: 25%;
}

ul, li, a {
  height: 100%;
}
相关问题