Facebook 风格的导航栏
这是我的 Rails 应用程序中的导航栏。问题是我不确定这是否可以跨浏览器工作,因为我正在调整锚标记的填充以获得所需的高度。另一个问题是搜索表单位于该导航栏内,并且不是在其中垂直居中。
我基本上想要一个 Facebook 风格的导航栏,它有一些像链接(带有悬停)的框和一个搜索表单(一个文本框和一个搜索图像都集成/看起来无缝)。右侧的搜索文本框和按钮不是无缝的,它们看起来是分开的。
帮助表示赞赏。
<div class="span-24 last nav_container ui-state-default">
<div class="main_links_div span-18">
<ul><li id="home_nav"><a href="/">New</a></li><li id="post_nav"><a href="/post_topics">posts</a></li><li id="cat_nav"><a href="#">Categories</a></li><li id="city_nav"><a href="#">Cities</a></li></ul>
</div>
<div class="span-6 last div-search-form"><form method="get" id="search_form" class="right" action="/searches">
<input type="text" value="City_Name" name="search_term" id="search_term" class="search-term">
<span class="small-button"><a id="search_button" href="#" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title="Search"><span class="ui-button-icon-primary ui-icon ui-icon-search"></span><span class="ui-button-text">Search</span></a></span>
</form>
</div>
</div>
CSS
main_links_div {
margin-bottom:0.4em;
vertical-align:baseline;
}
main_links_div ul {
display:inline;
margin-bottom:0 !important;
padding-left:0;
white-space:nowrap;
}
main_links_div li {
display:inline;
}
main_links_div li a {
font-size:1em;
padding:0.7em 0.8em;
}
right {
float:right;
}
small-button {
font-size:0.8em;
}
Here is the navbar in my rails app. The problem is I am not sure if this wil work cross browser because I am adjusting the padding of the anchor tags to get the required height. THe other issue is the search form is inside this navbar and it's not vertically centered on inside it.
I basically want a facebook style navbar that has a few box like links(with hover) and a search form (a textbox and a search image both integrated/looking seamless). Right the search textbox and the buttom are not seamless they look separate.
Help appreciated.
<div class="span-24 last nav_container ui-state-default">
<div class="main_links_div span-18">
<ul><li id="home_nav"><a href="/">New</a></li><li id="post_nav"><a href="/post_topics">posts</a></li><li id="cat_nav"><a href="#">Categories</a></li><li id="city_nav"><a href="#">Cities</a></li></ul>
</div>
<div class="span-6 last div-search-form"><form method="get" id="search_form" class="right" action="/searches">
<input type="text" value="City_Name" name="search_term" id="search_term" class="search-term">
<span class="small-button"><a id="search_button" href="#" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title="Search"><span class="ui-button-icon-primary ui-icon ui-icon-search"></span><span class="ui-button-text">Search</span></a></span>
</form>
</div>
</div>
THe css
main_links_div {
margin-bottom:0.4em;
vertical-align:baseline;
}
main_links_div ul {
display:inline;
margin-bottom:0 !important;
padding-left:0;
white-space:nowrap;
}
main_links_div li {
display:inline;
}
main_links_div li a {
font-size:1em;
padding:0.7em 0.8em;
}
right {
float:right;
}
small-button {
font-size:0.8em;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在使用某种您未指定的网格框架,但是,我很确定这就是您所追求的:
还记得添加“.”。在你的班级名称之前!
It looks like you are using some sort of a grid framework that you did not specify, however, I am pretty sure this is what you are after:
Also remember to put the '.' before your class names!