I've already learned bootstrap but I'm trying to learn foundation for a different project just to get some exposure to it. I'm wondering if there's any simple way to add a username/password form to the top nav bar similar to how bootstrap does? I've checked out the template called workspace here: http://foundation.zurb.com/page-templates/workspace.html and it has a search box in the top that looks very similar to what I want, but when I wrap a form around it, it goes haywire. Anybody have an idea how to do this in foundation?
What I'm trying to work with:
<nav class="top-bar contain-to-grid">
<ul>
<li class="name"><img src="/images/betalogo.jpg"></li>
<li class="toggle-topbar"></li>
</ul>
<section>
<ul class="left">
<li>Link 1</li>
<li>Link 2</li>
</ul>
<ul class="right">
<li>
<input type="text">
</li>
<li>
<input type="password">
</li>
<li class="has-button">
<input type="submit" class="small button" value="Log In">
</li>
</ul>
</section>
</nav>
From the source…
<ul class="right">
<li class="search">
<form>
<input type="search">
</form>
</li>
<li class="has-button">
<a class="small button" href="#">Search</a>
</li>
</ul>
This will get you the UI you want but not necessarily the functionality. I find the issue with this is that the submit button is outside the form—thereby useless; unless you use some JS to glue the button to the form which, frankly, breaks K.I.S.S.
Alternatively, you could use new rows inside your form. Thanks to Foundation's row nesting. Be sure to .collapse the row is you want the button to be right beside the search bar; omit this to keep the gutter between columns.
i know this is an old thread and i am sure you figured this out by now, but maybe someone else can use the answer.
<!-- Right Nav Section -->
<
ul class="right">
<li class="divider hide-for-small"></li>
<li class="active">Artists</li>
<li class="divider"></li>
<li class="active">Shows</li>
<li class="divider"></li>
<li class="active">Radio</li>
<li class="divider"></li>
<li class="active">Blog</li>
</li>
<li class="divider"></li>
<?php if(empty($_SESSION['user_id'])){ ?>
<li class="has-form signinform">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div class="row collapse">
<div class="columns username">
<input type="text" placeholder="Username" name="username">
</div>
<div class="columns password">
<input type="text" placeholder="Password" name="password">
</div>
</div>
</li>
<input type="submit" value="Login" name="login" class="button">
</form>
<?php }
######end show login######
?>
</ul>
This is just a past from my page, but you can see if you need to put a form in it you have to use the class "has-form" in the li tag
Try wrapping each list item in a column.
<ul class="right">
<div class="column">
<li class="username"><form><input type="text" placeholder="Username" /></li></div>
<div class="column">
<li><input type="password" placeholder="Password"></li></div>
<div class="column">
<li class="has-button"><a class="small button" href="#">Login</a></form></li></div>
</ul>
Related
Two things,
Nesting a form inside a menu item works except it hides again of the
mouse moves from the form div.
This form menu item is right aligned and the form left-most margin
is aligned with the left-most margin of the button so the actual
form flows beyond the window
<div class="home-menu pure-menu pure-menu-horizontal">
<a class="pure-menu-heading pure-menu-link" href="/">My Hip New Brand</a>
<ul class="pure-menu-list">
<li class="pure-menu-item">Blog</li>
<li class="pure-menu-item">Contact Us</li>
<li class="pure-menu-item">About</li>
</ul>
<ul class="pure-menu-list" style="float:right">
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">Sign In
<form action="/login" method="POST" class="pure-form pure-menu-children">
<fieldset class="pure-group">
<input name="username" type="text" placeholder="Username" class="pure-input-2-1" required/>
<input name="password" type="password" placeholder="Password" class="pure-input-2-1" required/>
</fieldset>
<button type="submit" class="pure-button pure-input-2-1 pure-button-primary">Sign In</button>
</form>
</li>
</ul>
</div>
EDIT: jsfiddle can be found here
I'm trying to align three items in the same row but am having problems doing this in Bootstrap 3. Here is how they look now:
But I want them to be aligned in the same row (horizontally) and not be aligned vertically.
I have a fiddle here: http://jsfiddle.net/DTcHh/2132/
The relevant code is:
<div class="pull-right">
<form action="#" method="post" class="form-horizontal">
<div class="control-label">
<div class="control">
Pull right on a form will only work if the form has a specific width. In most cases you don't want to use that, but use the grid system.
You should use .input-group to add buttons to an input and show them on the same line.
You're not using labels, so there is no use for .form-horizontal.
See the fiddle
<div class="row">
<div class="col-sm-3 col-md-3">
<ul class="nav nav-pills">
<li class="active">Pill1
</li>
<li class=""><span id="pendingcount">Pill2</span>
</li>
</ul>
</div>
<div class="col-sm-6 col-sm-push-3">
<form action="#" method="post">
<input type="hidden" value="Date" name="filtertype" class="dropdown-field">
<div class="input-group">
<span class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Date <span class="caret"></span></button>
<ul class="dropdown-menu">
<li> Date</li>
<li> Requestor</li>
<li> Classification</li>
<li> Destination</li>
<li> Description</li>
<li> File Name</li>
<li> Extracted Text</li>
<li> Extracted Keywords</li>
<li> Status</li>
<li> Scan Code</li>
</ul>
</span>
<input type="text" name="filterterm" value="" class="form-control">
<span class="input-group-btn">
<button type="submit" class="btn btn-default "> <i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</form>
</div>
</div>
I've created JSFiddle to illustrate my error.
I simply want to align all the "li" elements within the "ul"
<div id="easySearchMenu">
<ul>
<li>Categories
<ul>
<li>Classifieds</li>
<li>Business listings</li>
<li>Propetries</li>
</ul>
</li>
<li>Advanced Search</li>
<li>
<form id="searchForm">
<fieldset>
<div class="input">
<input type="text" name="s" id="s" value="Enter your search" />
</div>
<input type="submit" id="searchSubmit" value="" />
</fieldset>
</form>
</li>
<li>Log in / Register</li>
</ul>
</div>
You're using block level elements in your inner ul, causing unnecessary complications.
You could change your fieldset to display:inline-block to align those boxes, although that doesn't help with the different heights.
change your code like below
<div id="easySearchMenu">
<ul>
<li>Categories
<ul>
<li>Classifieds</li>
<li>Business listings</li>
<li>Propetries</li>
</ul>
</li>
<li>Advanced Search</li>
<li style="padding: 8px 20px 7px 20px;">
<form>
<div class="input">
<input type="text" name="s" id="s" value="Enter your search">
</div>
<input type="submit" id="searchSubmit" value="">
</form>
</li>
<li>Log in / Register</li>
</ul>
</div>
finaly change your css, from selector div.input remove the float:right; property/value pair.
Ok, well you see I have been able to successfully create a dropdown login form in Twitter Bootstrap. In Bootstrap it was much simpler, but this framework doesn't work that easily. This is what I am trying to achieve: https://lh4.googleusercontent.com/-A1GH5oiWNEI/UTg6JoR9kDI/AAAAAAAAAAM/g4BJNVkvLJ4/s1600/Drop-Down-Form-F3.png. Here is my current code: (I cut some parts out)
<nav class="top-bar">
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<h1>ChatAar</h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
Login
<ul id="hover1" class="f-dropdown" data-dropdown-content>
<!-- Login form here -->
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<div class="red"><?php echo $Login; ?></div>
<p>Username:</p>
<input name="user" type="text" class="field" id="user"/>
<p>Password:</p>
<input name="pass" type="password" class="field" id="pass" value="" />
<br />
<label style="text-color:white;">Remember Me For 30 Day's</lable>
<input name="remember" type="checkbox" value="true" />
<input name="page" type="hidden" value="<? echo $_GET['page']; ?>" />
<input name="submit" type="submit" class="button" value="Log In" />
<br />
Password Recovery | Sign Up
</div>
</form>
</ul>
</ul>
</section>
</nav>
And this is what I get:
http://webymaster.hj.cx/public.php?service=files&t=cdf517da96a2ad178045198169958afb. I have tried normal drop downs but it doesn't work (sorry dont have a pic) then I came up with this but, its not the best. Please Help Thank You!
Using Foundation 5, this will get you close:
<nav class="top-bar" data-topbar>
<section class="top-bar-section">
<ul class="right">
<li>Sign In</li>
</ul>
</section>
</nav>
<div id="signin" class="f-dropdown small content" data-dropdown-content>
<!-- signin form here -->
</div>
Note that the login form needs to be located outside of the top-bar, otherwise it will have badly mangled styles.
For a complete reference, examples, and ideas of how to customize it, check out Zurb's wonderful documentation on dropdowns and forms.
Expanding on chadoh's excellent answer, for anyone who's looking for something simple and ready to go:
<div id="login-dropdown" class="f-dropdown small content" data-dropdown-content="true">
<h5>Log In:</h5>
<form id="top-nav-login" action="login.xqy" method="post">
<div class="row">
<label>Email Address</label>
<input type="email" name="email" placeholder="email#example.com" tabindex="1"/>
</div>
<div class="row">
<label>Password</label>
<input type="password" name="email" placeholder="********" tabindex="2"/>
</div>
<div class="row">
<input type="submit" class="button tiny success" value="Login" tabindex="3"/>
</div>
</form>
</div>
This is just the dropdown part of the markup. You'll still need the top-bar and data-dropdown element from chadoh's answer. Obviously add your own form elements as needed.
I have a nav-bar with a menu with radio buttons as menu elements, but they don't aligh well:
<!DOCTYPE HTML>
<div class="navbar">
<div class="navbar-inner">
<ul class="nav pull-right">
<li>
<form method="get" action="search" class="navbar-form pull-right">
<input type="text" name="q" class="input-medium search-query" placeholder="Search">
</li>
<li id="nav_search_filter" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><b class="caret"></b></a>
<ul class="dropdown-menu">
<li>Search:</li>
<li>
<input type="radio" id="search_filter_all" name ="search_filter" value="all" checked="checked"/>
<label for="search_filter_all">All</label>
</li>
<li><input type="radio" id="search_filter_inactive" name ="search_filter" value="inactive" /> <label for="search_filter_inactive">Inactive</label></li>
<li><input type="radio" id="search_filter_active" name ="search_filter" value="active" /> <label for="search_filter_active">Active</label></li>
</ul>
</li>
</form>
</ul>
</div>
</div>
http://jsfiddle.net/2SmWq/
You could try something like this:
label {margin:10px;}
input[type="radio"] {display:inline-block; vertical-align:top;}
and wrapping the labels around the input tags in the html.
here is a jsfiddle to see what I mean.
Hope this helps.
If what you want it do have the radio button and the label in the same line. Try this:
<style>
label {
display:inline-block;
}
</style>