Bootstrap Ellipsis in list-group is resulting into overwritten rows - html

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

Related

Truncate on x-overflow inside list item

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>

Margin between checkboxes' labels when the input is hidden

I have some checkboxes styled to look like a select. I did this by setting the input to display:none and letting the label as the only visible element.
The problem is that I want some margin between the elements but it only seems to work when the checkbox is visible.
HTML:
<div class="dropdown">
<span class="tag">
<span class="tag-text">Talla</span>
<span class="tag-caret">&#9660</span>
</span>
<div class="dropdown-content">
<input type="checkbox" name="talla[]" id="36" class="filtro">
<label for="36" class="label">36</label>
<br>
<input type="checkbox" name="talla[]" id="37" class="filtro">
<label for="37" class="label">37</label>
<br>
<input type="checkbox" name="talla[]" id="38" class="filtro">
<label for="38" class="label">38</label>
<br>
</div>
</div>
CSS for the part I ask for:
input[type="checkbox"]
{
display:none;
}
label
{
padding:3px;
margin:10px;
border:1px solid lightslategrey;
border-radius: 1px;
}
I suggest you to wrapp the checkboxes and labels with a div instead of doing <br> and add the margin-bottom to those divs
input[type="checkbox"]
{
display:none;
}
label
{
padding:3px;
border:1px solid lightslategrey;
border-radius: 1px;
}
.checkbox-wrapper{
margin-bottom: 10px;
}
<div class="dropdown">
<span class="tag">
<span class="tag-text">Talla</span>
<span class="tag-caret">&#9660</span>
</span>
<div class="dropdown-content">
<div class="checkbox-wrapper">
<input type="checkbox" name="talla[]" id="36" class="filtro">
<label for="36" class="label">36</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" name="talla[]" id="37" class="filtro">
<label for="37" class="label">37</label>
</div>
<div class="checkbox-wrapper">
<input type="checkbox" name="talla[]" id="38" class="filtro">
<label for="38" class="label">38</label>
</div>
</div>
</div>
Use visibility: hidden; instead display:none
input[type="checkbox"]
{
visibility: hidden;
}
label
{
padding:3px;
margin:10px;
border:1px solid lightslategrey;
border-radius: 1px;
}
<div class="dropdown">
<span class="tag">
<span class="tag-text">Talla</span>
<span class="tag-caret">&#9660</span>
</span>
<div class="dropdown-content">
<input type="checkbox" name="talla[]" id="36" class="filtro">
<label for="36" class="label">36</label>
<br>
<input type="checkbox" name="talla[]" id="37" class="filtro">
<label for="37" class="label">37</label>
<br>
<input type="checkbox" name="talla[]" id="38" class="filtro">
<label for="38" class="label">38</label>
<br>
</div>
</div>

Display Icons inside a text box

I need the following controls in one line and aligned right. I need the two icons appear inside the textbox at the right corner. And also both the controls to be aligned right.
Here is the Plunker
<div class="col-md-12">
<div class="col-md-6">
<input type="text" id="txtDateRange"
class="form-control input-md" name="txtDateRange"
placeholder="Select Range"
ng-model="Model.RageDates" />
<span><i class="glyphicon glyphicon-remove" ></i></span>
<span class="form-control-feedback"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
</div>
<div class="col-md-6" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span>{{ selectedItem ? selectedItem.Label : 'ALL LOCATIONS' }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li ng-repeat="Label in Summary.Locations">
<a ng-click="dropboxitemselected(Label)">
{{Label.Label}}
</a>
</li>
</ul>
</div>
</div>
Bootstrap styles .form-control input elements as BLOCK (they are usually inline).
If you restyle that specific input element to inline-block and reduce the width a bit (unsure why that was necessary - perhaps only for SO snippet environment), you will be able to use margin-left on the span elements to walk them over a bit.
span.a1{margin-left:-50px;border:1px solid green;}
span.a2{border:1px solid red;}
#txtDateRange{display:inline-block;width:99.3%;}
div.a1 {display:inline-block;margin-left:-50px;border:1px solid green;}
div.a2 {display:inline-block; border:1px solid red;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<p> </p>
<div class="col-md-12">
<div class="col-md-6">
<input type="text" id="txtDateRange"
class="form-control input-md" name="txtDateRange"
placeholder="Select Range"
ng-model="Model.RageDates" />
<span class="a1"><i class="glyphicon glyphicon-remove" ></i></span>
<span class="a2 xform-control-feedback"><i class="glyphicon glyphicon-calendar xfa xfa-calendar"></i></span>
</div>
<div class="col-md-6" style="float: right;">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span>{{ selectedItem ? selectedItem.Label : 'ALL LOCATIONS' }}</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li ng-repeat="Label in Summary.Locations">
<a ng-click="dropboxitemselected(Label)">
{{Label.Label}}
</a>
</li>
</ul>
</div>
</div>
You may do it like this:
.col-md-6{
float: right;
}
.wrapper{
overflow: hidden;
}
#txtDateRange{
width: 100%;
}
<div class="col-md-12">
<div class="col-md-6">
<span><i class="glyphicon glyphicon-remove" ></i></span>
<span class="form-control-feedback"><i class="glyphicon glyphicon-calendar fa fa-calendar"></i></span>
</div>
<div class="wrapper">
<input type="text" id="txtDateRange"
class="form-control input-md" name="txtDateRange"
placeholder="Select Range"
ng-model="Model.RageDates" />
</div>
</div>

Can't get GIF to align horizontally with bootstrap input inside input-group

I would like to align a spinner just to the right of the input box but it is going underneath:
<form>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input type="text" class="form-control" placeholder="Search" ng-model="searchTerm" ng-change="FetchNearby(searchTerm)">
</div>
<span><img alt="Logo" src="/Content/Images/ajax-loader.gif" /></span>
</div>
</form>
something like this?
https://jsfiddle.net/1e0v352r/
i've added a class to your span and moved it inside of the .input-group
<form>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-search"></i>
</span>
<input type="text" class="form-control" placeholder="Search" ng-model="searchTerm" ng-change="FetchNearby(searchTerm)">
<span class="logo_right"><img alt="Logo" src="/Content/Images/ajax-loader.gif" /></span>
</div>
</div>
</form>
and added some css to position it
.logo_right {
position: absolute;
right: 0;
top: 0;
z-index: 5;
}

Bootstrap 3: how to control input width inside input-group?

See http://jsfiddle.net/7T9r9/ as an example.
<li>
<span class="row">
<div class="col-md-3">
<div class="input-group">
<span class="input-group-addon">
<input type="checkbox" class="checkbox"/>
</span>
<input type="text" class="form-control input-append" value="test">
<span class="input-group-addon"></span>
</div>
</div>
<div class="col-md-9">
<div class="input-group">
<input type="text" class="form-control"
value="test">
<span class="input-group-addon">
<a href="#">
<span class="glyphicon glyphicon-trash"></span>
</a>
</span>
</div>
</div>
</span>
</li>
What I would like to achieve is to have the first input width fitting the text inside of it (a fixed width would do as well I guess).
The second input should occupy the rest of the row and all the elements should be on the same line.
Is there a way to do this?
I'm guessing your fiddle is an example of the effect that you want, but you don't want to use different columns for it.
Dynamic width Text input based on value length is not possible (unless recently via some css goddess like Verou finding something). So assuming fixed width on that guy.
The other guy then can take advantage of the other fixed width to do a margin etc.
Something like this:
HTML
<span class="row">
<div class="test1 input-group">
<span class="input-group-addon">
<input type="checkbox" class="checkbox"/>
</span>
<input type="text" class="form-control input-append" value="test">
<span class="input-group-addon"></span>
</div>
<div class="test2 input-group">
<input type="text" class="form-control"
value="test">
<span class="input-group-addon">
<a href="#">
<span class="glyphicon glyphicon-trash"></span>
</a>
</span>
</div>
</span>
CSS
.row {
position:relative;
}
.test1 {
width:200px
}
.test2 {
position:absolute !important;
top:20px;
margin-left:200px;
}