Can I place two links in bootstrap menu - css

I'm using bootstrap 2.3 for menu links
<div class="span3">
<ul class="nav nav-pills nav-stacked">
<li class="active">My profile</li>
<li>Edit</li>
<li>Photos</li>
<li>Competitions</li>
<li>List of profiles</li>
</ul>
</div>
Is it possible to place two links (My profile and edit) in one line by using bootstrap like showed on picture or any other way to do it. Thanks.

You can achieve this with just CSS, using the nth-child selector. It is still responsive.
li:nth-child(1), li:nth-child(2) {
display:inline-block;
}
DEMO: http://jsfiddle.net/z5pXh/3/

nest another ul inside and a little additional css
CSS
ul.nav-edit {
margin-bottom: 0;
}
ul.nav-edit li.active {
display:inline-block;
width: 88%;
}
HTML
<div class="span3">
<ul class="nav nav-pills nav-stacked">
<li>
<ul class="nav nav-pills nav-edit">
<li class="active">My profile</li>
<li class="pull-right">Edit</li>
</ul>
</li>
<li>Photos</li>
<li>Competitions</li>
<li>List of profiles</li>
</ul>
</div>
Check out the fiddle at http://jsfiddle.net/Y2LUZ/

Live Demo
If fixed sizes are good for you, you can use this:
HTML
<div class="span3">
<ul class="nav nav-pills nav-stacked pos-rel">
<li class="col-first active">My profile</li>
<li class="col-second">Edit</li>
<li>Photos</li>
<li>Competitions</li>
<li>List of profiles</li>
</ul>
</div>
CSS
.pos-rel {
position: relative;
}
.col-first {
width: 300px;
}
.col-second {
position: absolute;
top: 0;
left: 305px;
}

Related

how to make a tree of `li` elements correctly near each other

For a filetree that is dynamically generated, I set the width to 360px and a scroll on the x.
I know, the syntax is not correct, (nested ul should be in li ) but I am still wondering why the hhhhh in code below is not at the right side of the |- but under it. And the iiiii and further also...
.tree {
width: 360px;
overflow-x: scroll;
}
.li-tree {
list-style: none;
}
<div class="tree">
<ul class="ul-tree">
<li class="li-tree">|-<span>aaaaa</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>bbbbb</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>ccccc</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>ddddd</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>eeeee</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>fffff</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>ggggg</span></li>
<ul class="ul-tree">
<li class="li-tree">|-<span>hhhhh</span></li>
<ul class="ul-tree">
<li class="li-tree">|<span>iiiii</span></li>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</ul>
</div>
You can see in the fiddle that hhhhh is not right of the |- anymore, but under it: https://jsfiddle.net/a9fudsb6/5/
Its because of your width there is no space for your tree.
If you change it e.g. to
width = 400;
it appears inside.
If you want to keep your width, add the following:
.tree {
width: 360px;
overflow-x: scroll;
white-space:nowrap; // that one here
}

Issue with CSS 'everything except last' selector

I have a list of sub-lists. Each sublist has its own children. I need to apply style to all except the last sub-list. I use:
.list:not(:last-child) > .sublist {
color: red;
}
But it is applying for all the sublists. Here's a demonstrating code (fiddle:
http://jsfiddle.net/8m72m53r/3/):
:not(:last-child) > .row {
color: red;
}
<ul class="box">
<li class="row">One</li>
<li class="row">Two</li>
<li class="row">Three</li>
</ul>
<ul class="box">
<li class="row">FOur</li>
<li class="row">Five</li>
<li class="row">Six</li>
</ul>
<ul class="box">
<li class="row">Seven</li>
<li class="row">Eight</li>
<li class="row">Nine</li>
</ul>
Here you go - you pretty much had it, just make sure to use the :last-of-type pseudoclass
.box:not(:last-of-type) > .row {
color: red;
}
<ul class="box">
<li class="row">One</li>
<li class="row">Two</li>
<li class="row">Three</li>
</ul>
<ul class="box">
<li class="row">FOur</li>
<li class="row">Five</li>
<li class="row">Six</li>
</ul>
<ul class="box">
<li class="row">Seven</li>
<li class="row">Eight</li>
<li class="row">Nine</li>
</ul>
This might help you:
.box>.row:not(:last-of-type)
I'm not sure if you are looking for this. But if you want to style all items but the last ones, use something like this:
.row:not(:last-child) {
color: red;
}

Horizontal Nav Tabs Dropdown

I've been having some issues with getting a dropdown to be horizontal (and 100% width of the column). I have tried a lot of pieces of code and of course adjusted a ton of things, but have not been able to get this done yet.
Please keep in mind of the following:
Using Bootstrap V3.3.7
Make sure to use nav-tabs (not normal navbar)
It should only be 100% of the width of the column
I hope someone is able to help me out with this.
Regards,
Siranix
EDIT: As requested, here's a bootply try / my code: Bootply
I think you need to remove position: static; , Please let me know is that what you want.
.nav > li.dropdown.open {
}
.nav > li.dropdown.open .dropdown-menu {
display:table;
width: 100%;
text-align: center;
left:0;
right:0;
}
.dropdown-menu>li {
display: table-cell;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<ul class="nav nav-tabs">
<li class="active">General </li>
<li class="dropdown"><a data-toggle="dropdown" aria-expanded="true" href="#" class="dropdown-toggle"><i class="fa fa-users"></i> Example Dropdown<span class="caret"></span></a>
<ul role="menu" class="dropdown-menu suf-ver-tabdropdown">
<li role="presentation">First Item</li>
<li role="presentation">Second Item</li>
<li role="presentation">Third Item</li>
</ul>
</li>
<li>Second Tab</li>
<li>Third Tab</li>
</ul>

show multi column on hover in bootstrap using custom css

<nav class="navbar navbar-default" style="width:100%">
<div class="container">
<ul class="nav navbar-nav">
<li><span class="glyphicon glyphicon-home"></span></li>
<li ><a id="firstid" href="#">FOR HIM</a></li>
<li><a href="#" >FOR HER</a></li>
<li>FOR KIDS</li>
<li>PERSONALIZED</li>
<li>BIRTHDAYS</li>
<li>NOVELTY</li>
<li>HOME</li>
<li>EXPERIENCES</li>
<li>OCCASIONS</li>
<li>NEW</li>
</ul>
<ul id="multicol-menu" class="nav pull-right">
<li class="dropdown">
MultiCol Menu <b class="caret"></b>
<ul class="dropdown-menu">
<li>
<div class="row" style="width: 400px;">
<ul class="list-unstyled col-md-4">
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
<ul class="list-unstyled col-md-4">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
<ul class="list-unstyled col-md-4">
<li>a</li>
<li>b</li>
<li>c</li>
</ul>
</div>
</li>
</ul>
</li>
</ul>
</div>
CSS
#multicol-menu{
display: none;
}
#firstid:hover #multicol-menu{
display: block;
}
I have written above code having a navigation bar now i want to show 3 columns list item on hover.I have tried different things but could't get the result.it would be very nice it anyone provide same as in the image. i have written custom css too but its not working.My intention is to show like in the image
https://i.stack.imgur.com/Nthnl.png
Well, try the following CSS:
div.row {
width: 400px;
display: none;
opacity: 0;
}
ul.list-unstyled {
float: left;
width: 30%;
}
#multicol-menu li.dropdown:hover {
display: block;
opacity: 1;
}

Zurb foundation top bar search input

I'm using zurb foundation 4.
I create a top bar with a search form within the same:
<nav class="top-bar">
<ul class="title-area">
<li class="name">
<h1>Title</h1>
</li>
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<!-- Left Nav Section -->
<ul class="left">
<li class="has-form">
<form>
<div class="row collapse" >
<div class="small-10 columns">
<input type="text">
</div>
<div class="small-2 columns">
S
</div>
</div>
</form>
</li>
</ul>
<!-- Right Nav Section -->
<ul class="right">
<li class="divider"></li>
<li class="has-dropdown">Drop1
<ul class="dropdown">
<li>Dropdown Level 3a</li>
<li>Dropdown Level 3b</li>
<li>Dropdown Level 3c</li>
</ul>
</li>
<li class="divider"></li>
<li class="has-dropdown">Drop2
<ul class="dropdown">
<li>Dropdown Level 3a</li>
<li>Dropdown Level 3b</li>
<li>Dropdown Level 3c</li>
</ul>
</li>
</ul>
</section>
I need to increase the size in the search field without losing responsiveness. Does anyone have any idea how can I do?
http://cl.ly/image/1a412p3M3e1J
If you're using SASS, simply change:
input { height: $topbar-input-height }
To:
input { height: $topbar-height }
If you're using CSS, change the line with:
.top-bar input { height: 2.45em; }
To:
.top-bar input { height: 45px; }
Follow a similar process if you wish to change the width.
I am a big fan of CDN, so editing the Foundation files is not an option.
Here is the workaround that works for me:
.top-bar input {
height: auto !important;
padding-top: .35rem !important;
padding-bottom: .35rem !important;
}

Resources