html - Horizontal bar with overflow hidden being weird -
i made bar (nav2) scrollable if it's not enough screen space, seems weird (also because it's first time i'm doing such thing horizontal scrollable bar), ul going somewhere in top, , doesn't come down, tried float: left, works, ul not centered in middle (that's important!)
body { font-family: 'clear sans', verdana, sans-serif; margin: 0; } #nav1 { width: calc(100% / 3); height: 40px; line-height: 40px; background-color: black; float: left; } #nav2 { width: calc(100% / 3); height: 40px; background-color: red; float: left; overflow: scroll; } #nav3 { width: calc(100% / 3); height: 40px; background-color: yellow; float: left; } #nav2 ul { list-style-type: none; padding: 0; margin: 0; display: block; height: 40px; float: left; } #nav2 ul li { display: inline; color: black; text-decoration: none; } #nav2 ul { padding: 5px 17px; text-decoration: none; color: white; } @keyframes sin { 0% {transform: rotate(0deg)} 100% {transform: rotate(360deg)} } #yvelogo { margin-left: 17px; padding: 0; height: 20px; display: inline-block; vertical-align: middle; line-height: normal; } #yvelogo { border: 0; } <!doctype html> <html> <head> <meta charset="utf-8"> <title>yvemiro</title> <meta name="author" content="hate"> <meta name="description" content="description gogel"> <meta name="keywords" content="yve,miro,blog"> <link rel="stylesheet" href="http://static.tumblr.com/zicio7x/hgpnuuz05/fonts.css" type="text/css"> </head> <body> <div id="navbar"> <div id="nav1"><a href="#"><img id="yvelogo" alt="eeh, ie or what" src="http://static.tumblr.com/zicio7x/vtfnvi4e4/yvelogowhite.svg"></a></div> <div id="nav2"> <ul> <li><a href="#">blog</a></li><li><a href="#">stuff</a></li><li><a href="#">me</a></li><li><a href="#">ask</a></li><li><a href="#">archive</a></li> </ul> </div> <div id="nav3"></div> </div> </body> </html>
$(document).ready( function() { $("#nav2").nicescroll(); } ); body { font-family: 'clear sans', verdana, sans-serif; margin: 0; } #nav1 { width: 33%; height: 40px; line-height: 40px; background-color: black; float: left; } #nav2 { width: 34%; height: 40px; background-color: red; overflow: hidden; display: inline-block; vertical-align: middle; } #nav3 { width: 33%; height: 40px; background-color: yellow; float: right; } #nav2 ul { list-style-type: none; padding: 0; margin: 0; display: block; } #nav2 ul li { display: inline; color: black; text-decoration: none; } #nav2 ul { padding: 5px 17px; text-decoration: none; color: white; } @keyframes sin { 0% {transform: rotate(0deg)} 100% {transform: rotate(360deg)} } #yvelogo { margin-left: 17px; padding: 0; height: 20px; display: inline-block; vertical-align: middle; line-height: normal; } #yvelogo { border: 0; } @media (max-width:990px) { #nav2 { overflow-y: hidden; overflow-x: scroll; } } <!doctype html> <html> <head> <meta charset="utf-8"> <title>yvemiro</title> <meta name="author" content="hate"> <meta name="description" content="description gogel"> <meta name="keywords" content="yve,miro,blog"> <link rel="stylesheet" href="http://static.tumblr.com/zicio7x/hgpnuuz05/fonts.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://areaaperta.com/nicescroll/js/jquery.nicescroll.min.js"> </script> </head> <body> <div id="navbar"> <div id="nav1"><a href="#"><img id="yvelogo" alt="eeh, ie or what" src="http://static.tumblr.com/zicio7x/vtfnvi4e4/yvelogowhite.svg"></a></div> <div id="nav2"> <ul> <li><a href="#">blog</a></li><li><a href="#">stuff</a></li><li><a href="#">me</a></li><li><a href="#">ask</a></li><li><a href="#">archive</a></li> </ul> </div> <div id="nav3"></div> </div> </body> </html> this should fix bit. if need vertical centering, can revise once more.
edit: added custom scrollbar plugin , jquery. more information editing scrollbar can found @ plugin's official website here
Comments
Post a Comment