Is there a way to make the nice text-overflow: ellipsis; work on long names (class name) in my list, adding to this CSS & HTML? Note how the 55026 ID is wrapped below in an ugly fashion on the last time.
.my-list {
width: 275px;
}
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<ul class="list-group my-list">
<li class="preferred-payer list-group-item">
<label class="checkbox-inline">
<input id="option-one" type="checkbox" name="select" value="60054">
<span class="name">Item Name One</span>
</label>
<span class="id pull-right">60054</span>
</li>
<li class="preferred-payer list-group-item">
<label class="checkbox-inline">
<input id="option-one" type="checkbox" name="select" value="00562">
<span class="name">Item Name Two</span>
</label>
<span class="id pull-right">00562</span>
</li>
<li class="preferred-payer list-group-item">
<label class="checkbox-inline">
<input id="option-one" type="checkbox" name="select" value="55026">
<span class="name">A Really Long Item To Truncate </span>
</label>
<span class="id pull-right">55026</span>
</li>
</ul>
You can consider a row/col configuration then add overflow:hidden to truncate the text:
.my-list {
width: 275px;
padding: 0 15px;
}
.my-list>.row {
margin: 0;
}
label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<ul class="list-group my-list">
<li class="preferred-payer list-group-item row ">
<label class="checkbox-inline col-xs-9">
<input id="option-one" type="checkbox" name="select" value="60054">
<span class="name">Item Name One</span>
</label>
<span class="id pull-right col-xs-3">60054</span>
</li>
<li class="preferred-payer list-group-item row">
<label class="checkbox-inline col-xs-9">
<input id="option-one" type="checkbox" name="select" value="00562">
<span class="name">Item Name Two</span>
</label>
<span class="id pull-right col-xs-3">00562</span>
</li>
<li class="preferred-payer list-group-item row">
<label class="checkbox-inline col-xs-9">
<input id="option-one" type="checkbox" name="select" value="55026">
<span class="name ">A Really Long Item To Truncate </span>
</label>
<span class="id pull-right col-xs-3">55026</span>
</li>
</ul>
Related
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="card attribute filter-panel" data-type="select" data-id="1">
<div class="card-header">
<i class="fa fa-angle-down pull-right"></i>
<span class="card-title">color</span>
</div>
<div class="card-body" style="padding: 0px; padding-top: 15px">
<ul class="filter-ul">
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck1" value="1">
<label class="custom-control-label " for="customCheck1">red</label>
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck2" value="2">
<label class="custom-control-label " for="customCheck2">blue</label>
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck3" value="3">
<label class="custom-control-label " for="customCheck3">green</label>
</div>
</li>
</ul>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
Current position
I want the checkboxes to float to the right of the text, I have tried float:right obviously didn't work.
how can i float them to the right ?
I use postition: absolute to move your boxes to right side and content to left side, hope this heck is work great.
You can play with right CSS property to get exact result you want.
.custom-control-label::before ,.custom-control-label::after {
right: 0;
}
label span {
position: absolute;
right: 21px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div class="card attribute filter-panel" data-type="select" data-id="1">
<div class="card-header">
<i class="fa fa-angle-down pull-right"></i>
<span class="card-title">color</span>
</div>
<div class="card-body" style="padding: 0px; padding-top: 15px">
<ul class="filter-ul">
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck1" value="1">
<label class="custom-control-label " for="customCheck1"><span>red</span></label>
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck2" value="2">
<label class="custom-control-label " for="customCheck2"><span>blue</span></label>
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck3" value="3">
<label class="custom-control-label " for="customCheck3"><span>green</span></label>
</div>
</li>
</ul>
</div>
</div>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="card attribute filter-panel" data-type="select" data-id="1">
<div class="card-header">
<i class="fa fa-angle-down pull-right"></i>
<span class="card-title">color</span>
</div>
<div class="card-body" style="padding: 0px; padding-top: 15px">
<ul class="filter-ul">
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<label class="custom-control-label " for="customCheck1">red</label>
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck1" value="1" style="float:right">
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<label class="custom-control-label " for="customCheck2">blue</label>
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck2" value="2"style="float:right">
</div>
</li>
<li>
<div class="custom-control custom-checkbox" style="direction: rtl ; text-align: right">
<label class="custom-control-label " for="customCheck3">green</label>
<input type="checkbox" class="custom-control-input filter-checkbox " id="customCheck3" value="3"style="float:right">
</div>
</li>
</ul>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
Check this code.I set the checkboxes to the right side of text. I think that's what your problem was.I hope this will help you :)
Here is my code with ellipsis
<div class="list-group" id="NotificationList">
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="notificat" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">This is your first notification. This is your first notification. This is your first notification. This is your first notification.
</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="notificat" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
</div>
CSS :
.checkbox {
float: left;
}
.notificat {
max-width: 300px;
float: left;
}
Fiddle: https://jsfiddle.net/SimplytheVinay/fqfmh818/1/
Here is another one without ellipsis, which is working as per my expectation.
<div class="list-group" id="NotificationList">
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
</div>
CSS :
.checkbox {
float: left;
}
Fiddle : https://jsfiddle.net/SimplytheVinay/mp97gLjm/
Try changing display of notificat class to inline-block then there is no need to floating left.
.notificat {
max-width: 300px;
display: inline-block;
}
.checkbox {
float: left;
}
.notificat {
max-width: 300px;
display: inline-block;
}
.list-group-item{
padding: 9px 15px !important; /* adjust padding from 10px to 9px to keep same list view after adding Ellipsis */
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="list-group" id="NotificationList">
<a data-toggle="modal" data-target="#notificationModal" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
<a data-toggle="popover" data-placement="top" data-content="This is your first notification." class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="notificat" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">This is your first notification. This is your first notification. This is your first notification. This is your first notification.
</span>
<span class="badge">12:10 AM</span>
</a>
<a href="#" class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox">
</label>
</div>
<span class="notificat" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">This is your first notification.</span>
<span class="badge">12:10 AM</span>
</a>
</div>
You can just remove " float: left; " this class " .notificat "
Remove this:
.notificat {
float: left;
}
See Updated Fiddle Demo
I'm using Bootstrap (2.3.2) multiselect in a Rails web application. The features I have used in multiselect are shown below:
<script type="text/javascript">
$(function() {
$('#coder_prod_select_client').multiselect({
includeSelectAllOption: true,
enableCaseInsensitiveFiltering: true,
numberDisplayed: 0,
nonSelectedText: 'Select Facility',
maxHeight: 450
});
});
</script>
Below is the HTML Code:
<div id="coder_prod_facilities_for_select">
<select name="facility[]" multiple="multiple" id="coder_prod_select_facility" style="display: none;">
<option value="multiselect-all"> Select all</option>
<optgroup label="Group 1">
<option value="114">Ancillary</option>
<option value="115">Inpatient</option>
<option value="117">Emergency</option>
</optgroup>
<optgroup label="Group 2">
<option value="80">Inpatient</option>
<option value="81">SS Surgery</option>
<option value="90">Emergency</option>
</optgroup>
<optgroup label="Group 3">
<option value="73">Inpatient</option>
<option value="75">Observation</option>
<option value="76">SS Surgery</option>
<option value="77">Ancillary</option>
</optgroup>
</select>
<div class="btn-group">
<button data-toggle="dropdown" class="multiselect dropdown-toggle btn btn-default" type="button" title="Select Facility">
Select Facility
<b class="caret"></b>
</button>
<ul class="multiselect-container dropdown-menu" style="max-height: 450px; overflow-y: auto; overflow-x: hidden;">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input type="text" class="form-control multiselect-search" placeholder="Search">
</div>
<li>
<a href="javascript:void(0);" class="multiselect-all">
<label class="checkbox"><input type="checkbox" value="multiselect-all"> Select all</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 1</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="114"> Ancillary</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="115"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="117"> Emergency</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 2</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="80"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="81"> SS Surgery</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="90"> Emergency</label>
</a>
</li>
<li style="display: list-item;">
<label class="multiselect-group">Group 3</label>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox">
<input type="checkbox" value="73"> Inpatient</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="75"> Observation</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="76"> SS Surgery</label>
</a>
</li>
<li style="display: list-item;">
<a href="javascript:void(0);">
<label class="checkbox"><input type="checkbox" value="77"> Ancillary</label>
</a>
</li>
</ul>
</div>
</div>
Below you can see the view / HTML by default.
You could see there are similar elements under each group. For e.g, When I filter using the value 'inpatient', it is showing the result as shown in the below attachment.
But, each of the filtered 'Inpatient' values belong to separate Groups and all values should have been shown with it's group names on top!!, but it is not.
Could anyone please help me to identify and fix the issue?
You may want to check the js again, shouldn't it be $("#coder_prod_select_facility").multiselect(...)?
I'm trying to align a radio button, an input and some text inside one of my list-group-items, it looks good #desktop but #mobile it goes one on top of the other.
This is my code so far
<div class="panel panel-default">
<div class="panel-body">
<span style="color: #990000; font-size:17px;"><strong>8,55 €</strong></span> text
<ul class="list-group">
<li class="list-group-item"><input name="1" type="radio"> 1 text <strong>8,55 €</strong></li>
<li class="list-group-item"><input name="2" type="radio"> 3 text <strong>8,55 €</strong></li>
<li class="list-group-item"><input name="3" type="radio"> 6 text <strong>8,55 €</strong></li>
<li class="list-group-item">
<div class="container-fluid">
<div class="row">
<div class="col-md-1"><input name="n" type="radio" ></div><div class="col-md-3"><input type="text" name ="text" id="amount" class="form-control" placeholder="12"></div><div class="col-md-8" >text<strong>8,55 €</strong></div>
</div>
</div>
</li>
</ul>
</div>
</div>
Is there anything I can do to have it responsive and aligned in mobile as well as dekstop?
You can use col-xs-* in place of col-md-*: fiddle example
<div class="col-xs-1">
<input name="n" type="radio" >
</div>
<div class="col-xs-3">
<input type="text" name ="text" id="amount" class="form-control" placeholder="12">
</div>
<div class="col-xs-8" >
text<strong>8,55 €</strong>
</div>
I have a Bootstrap dropdown menu. The last li item is a submenu. How do I get the submenu to dropup while the full menu drops down? Here's the code:
<div class="dropdown">
<a class="inputBarA dropdown-toggle" data-toggle="dropdown" href="#">FILTER</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li role="presentation">
<a role="menuitem" href="#">Text</a>
</li>
<li role="presentation">
<label>Label name</label>
<label>Label name</label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
<label class="checkbox">
<input type="checkbox">
Text </label>
</li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">Centralities</a>
<ul class="dropdown-menu">
<label class="radio">
<input type="radio" name="options" id="optionsRadios1" value="A" checked>
AA </label>
<label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="B">
BB </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="C">
CC </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="D">
DD </label><label class="radio">
<input type="radio" name="options" id="optionsRadios2" value="E">
EE </label>
</ul>
</li>
</ul>
</div>
The best solution:
<div class="dropup">
<ul class="dropdown-menu"></ul>
</div>
It's a native class in bootstrap. The bootstrap (using 3.1.1) css file has a .dropup .dropdown-menu selector so that's how I found out.
It sounds like the answer below would be how to do it from scratch, I was unaware there was a dropup class in Bootstrap...
So the short Bootstrap answer is to apply the class "dropup" to the <ul> in earlier versions of bootstrap:
<ul class="dropdown-menu dropup" role="menu" aria-labelledby="dLabel">
However in newer versions of bootstrap (v3) the "dropup" class needs to be applied to the <ul>'s container instead of the the <ul> itself:
<div class="dropup">
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
</div>
See http://jsfiddle.net/ZgyZP/5/
Original working answer that doesn't use bootstrap:
You could use javascript to calculate the height of the submenu and then negatively offset the submenu's position.
something like (with jQuery):
$('.dropdown-submenu').hover(
function(){
//hover in
$('.dropdown-submenu > ul').css('top', '-' + $('.dropdown-submenu > ul').css('height'));
},
//hover out
function(){
}
);
Fiddle: http://jsfiddle.net/ZgyZP/4/
Use a class, like up
<ul class="dropdown up">
Write style of up
.up { bottom:100% !important; top:auto !important; }
Note: Increase bottom as per your button size.
<div class="dropup">
<ul class="dropdown-menu"></ul>
</div>
The above code is correct, but doesn't work unless a parent element has the position property set.
Examples that works are class="col-lg-12" or just
<div style="position: relative;">
I use Bootstrap v3.0.0.
I used the dropup Class, and it worked perfectly as i expected it.
<div class="col-md-6 dropup">
<span uib-dropdown auto-close="outsideClick">
<p class="input-group">
<input type="text" class="form-control" ng-model="int.schTimeFormatted" ng-disabled="true" name="schTime" />
<span class="input-group-btn">
<button type="button" class="btn btn-default cal" uib-dropdown-toggle>
<i class="glyphicon glyphicon-time"></i>
</button>
</span>
</p>
<ul class="dropdown-menu" uib-dropdown-menu aria-labelledby="simple-dropdown">
<li class="timerDropdown">
<div class="row">
<div class="col-md-6">
<div uib-timepicker ng-model="int.schTime" ng-change="changed()" hour-step="hstep" minute-step="mstep" readonly-input="true" min="min"
max="max" show-meridian="ismeridian"></div>
</div>
<div>
Booked Timeslots
<ul id="timeListB">
<li ng-repeat="time in bookedTimeslots">{{time | date:"h:mma"}}</li>
</ul>
</div>
</div>
<hr>
<button class="pull-right">close</button>
</li>
</ul>
</span>
</div>