Bootstrap: div inside li - html

I am trying to add divs to the list items of my ul, but this is causing the Twitter Bootstrap framework to behave weirdly. Is this because of something I am doing wrong, or is there a different solution for what I am trying to do?
The code:
<h3>Track listing</h3>
<ul class="list-group">
<li class="list-group-item">
<div class="song-title">1. Song Title</div>
<div class="song-duration">3:50</div>
</li>
<li class="list-group-item">
<div class="song-title">2. Song Title</div>
<div class="song-duration">3:50</div>
</li>
<li class="list-group-item">
<div class="song-title">3. Song Title</div>
<div class="song-duration">3:50</div>
</li>
</ul>
The CSS code:
.song-title {float: left;}
.song-duration {float: right;}
I am using the float attributes in an attempt to make each song's title appear on the left, and the durations on the right. From my (very limited) CSS experience, this should work.
The result:
I have the impression that the list items' sizes are not taking the div sizes in consideration, instead resizing as if they were completely empty.
Any thoughts?

You can clear:both on the li to treat the li as a block level element.
(Add a clearfix on the li)
Track listing
<ul class="list-group">
<li class="list-group-item clearfix">
<div class="song-title">1. Song Title</div>
<div class="song-duration">3:50</div>
</li>
<li class="list-group-item clearfix">
<div class="song-title">2. Song Title</div>
<div class="song-duration">3:50</div>
</li>
<li class="list-group-item clearfix">
<div class="song-title">3. Song Title</div>
<div class="song-duration">3:50</div>
</li>
</ul>
Check this fiddle

It pretty late to answer this question but I thought it will help some-one if they want to try alternative approach to the accepted solution.
I kept the structure in a container and set its max-width property to 100%
<ul class="list-group">
<li class="list-group-item">
<div class="container" style="max-width:100%">
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
</div>
</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>

Related

I don't know why my footer is not 100% wide with bootstrap 4.0

My footer is not getting 100% wide and i really don't know what is wrong. Maybe there's a problem with container nesting, but i don't know how to fix it properly. I've just started learning Bootstrap, so this is my first code with it.
<div class="container-fluid d-flex align-items-center justify-content-around">
<footer class="container-fluid align-items-center text-center">
<div class="row">
<div class="col-4">
<ul class="list-unstyled">
<li class="mb-2 font-weight-bolder">Links</li>
<li class="mb-2"><a class="text-reset" href="#">Home</a></li>
<li class="mb-2"><a class="text-reset" href="#">Cardápio</a></li>
<li class="mb-2"><a class="text-reset" href="#">Contato</a></li>
</ul>
</div>
<div class="col-8">
<ul class="list-unstyled">
<li class="mb-2 font-weight-bolder">Pizzas</li>
<li class="mb-2"><a class="text-reset" href="#">Tradicionais</a></li>
<li class="mb-2"><a class="text-reset" href="#">Nobres</a></li>
<li class="mb-2"><a class="text-reset" href="#">Doces</a></li>
</ul>
</div>
</div>
<p class="align-items-center">Pizzaria.com.br</p>
</footer>
</div>
Here is the website print
Any suggestions?
You can try this in your .css file
body{
margin:0;
padding:0;
}

Bootstrap 4 list group works in Firefox, not in Chrome or Edge

I use the bootstrap 4 css framework, and I use a list group like this:
<div class="container">
<div class="col-12 col-md-6 col-lg-4">
<div>
<div class="list-group">
<a class="list-group-item list-group-item-action" href="/">Estonian Language</a>
<br>
<a class="list-group-item list-group-item-action" href="/">International Winter Program</a>
<br>
<a class="list-group-item list-group-item-action" href="/">Literature and Film in Vienna around 1900</a>
<br>
<a class="list-group-item list-group-item-action" href="/">Business and Entrepreneurship in the Start-Up Nation</a>
</div>
</div>
</div>
Which is similar to the example on the bootstrap website. It looks just like it should when I use Firefox, but when I use Chrome or Edge some gap is created between the different items. When I inspect the element it does not show a margin or some padding, so I don't know why this happens or how to solve it. Any idea's why this happens? Is it a bug?
Bootply example here
You're not using it as the getbootstrap site advises. You're using a div to identify your list group, and it is a ul>li structure.
From the getbootstrap site:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<ul class="list-group">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>

Making lateral menu take 100% height with 100vh when scrolling down the page

I'm currently stuck, I'm trying to make a div take 100% height with 100vh (position fixed is not an option). It works, but only for the active window, when we scroll, the div stop taking 100% height.
I've searched on the other topics, and I tried min-height : 100vh, also tried put position relative and min-height: 100% on html and body tags, but it doesn't work for me.
Maybe I have to specify that I'm using bootstrap 3.
HTML
<div id="bel-menu" class="col-sm-3 col-md-2 col-lg-2">
<ul id="custom-menu" class="nav nav-pills nav-stacked" role="menu" aria-labelledby="dropdownMenu">
<li role="presentation" class="groupe-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">Groupe</a>
<div class="menu-arrow"></div>
<ul class="dropdown-menu secondary-menu">
<li class="">Groupe</li>
<li class="">Mission</li>
<li class="">Marques et produits</li>
<li class="">Engagements</li>
<li class="">Temps forts</li>
<li class="">Implantations</li>
<li class="">Bel dans le monde</li>
<li class="">Finance</li>
<li class="">Gouvernance</li>
<li class="">Présenter Bel</li>
</ul>
</li>
<li class="workplace-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Workplace
<div class="menu-arrow"></div>
</li>
<li class="documents-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Documents
<div class="menu-arrow"></div>
</li>
<li class="moi-chez-bel-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Moi chez Bel
<div class="menu-arrow"></div>
</li>
<li class="applications-icon dropdown-submenu main-menu">
<div class="blue-bar"></div>
Applications
<div class="menu-arrow"></div>
</li>
</ul>
<div class="col-sm-3 col-md-2 col-lg-2 nopad open-btn">
<div class="arrow-icon"></div>
</div>
</div>
CSS
#bel-menu {
height: 100vh;
padding: 0;
background-color: #333;
}
Take a look to my project : https://jsfiddle.net/e94wewad/
The div I'm talking about is the one, that is containing the lateral menu.
The menu is taking 100% of the viewport, but when I scroll down, it stops.

Tree view expand collapse functionality?

I want to add expand & collapse functionality in the tree view list..how to add this?
I have added the jqueries required. . .
<div id="sidetree">
<div class="company">Company</div>
<div id="sidetreecontrol" class="sidetreecontrol"></div>
<ul class="treeview" id="tree">
<li>Home</li>
<li class="expandable">
<div class="hitarea expandable-hitarea"></div>
<span><strong>About Us</strong></span>
<ul style="display: none;">
<li>Our Offers</li>
<li class="last">Our Offers</li>
</ul>
</li>
</ul>
</div>
I think adding
Collapse All | Expand All
should do the trick.

How to set tabs according specific grids in bootstrap?

I'll be glad if you can help me on a specific issue for which I haven't find
any solution for that.
I have to make a web page in bootstrap which includes horizontal tabs.
The issue is that I need that The first tab will start from the
2nd grid and beyond as seen below:
I tried with my code but nothing works as expected in the image above:
.nav-tabs-colors {
background-color: #ececef;
}
.edit-app-tabs {
background-color:#ececef;
}
#edit-app-tab {
background-color:#ececef;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="tabbable edit-app-tabs">
<ul class="nav nav-tabs nav-tabs-colors">
<div class="col-lg-offset-1"><li role="presentation"></li></div>
<li role="presentation">Tab1</li>
<li role="presentation" class="active">Tab2</li>
<li role="presentation">Tab3</li>
<li role="presentation">Tab4</li>
<li role="presentation">Tab5</li>
<li role="presentation">Tab6</li>
<li role="presentation">Tab7</li>
<li role="presentation">Tab8</li>
</ul>
<div class="tab-content">
<div id="edit-app-tab" class="tab-pane fade in active">
<div class="row">
<h3>Content Content Content</h3>
</div>
</div>
</div>
<div>
Can you please show me how to exact fit the tabs according to specific grid ?
Thanks in Advance for your help!
EVH671
You could for instance put your tabs into a divider with col-md-offset-1 class
.nav-tabs-colors {
background-color: #ececef;
}
.edit-app-tabs {
background-color: #ececef;
}
#edit-app-tab {
background-color: #ececef;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="tabbable edit-app-tabs">
<ul class="nav nav-tabs nav-tabs-colors col-md-offset-1">
<div class="">
<li role="presentation"></li>
</div>
<li role="presentation">Tab1
</li>
<li role="presentation" class="active">Tab2
</li>
<li role="presentation">Tab3
</li>
<li role="presentation">Tab4
</li>
<li role="presentation">Tab5
</li>
<li role="presentation">Tab6
</li>
<li role="presentation">Tab7
</li>
<li role="presentation">Tab8
</li>
</ul>
<div class="tab-content">
<div id="edit-app-tab" class="tab-pane fade in active">
<div class="row">
<h3>Content Content Content</h3>
</div>
</div>
</div>
<div>
More on grids: http://getbootstrap.com/css/#grid
Bare in mind that this offset's the div by 1 column in medum viewport and up.
and it'd be wise to have your whole layout structured properly with containers, rows and columns.