Reputation: 4624
Tooltip is wordwrapping, the text spills to newline. How to fix this, I prefer to show texts in single line rather than multiline? Here is the JSBin
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<div class="form-group">
<label class="col-xs-2 control-label">Name</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="name" data-toggle="tooltip" title="Lorem ipsum dolor" data-placement="right"/>
</div>
</div>
</body>
</html>
Upvotes: 1
Views: 229
Reputation: 4490
There may be different solutions for your problem. One possible solution is to change predefined tool tip style a little bit.
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
.tooltip.fade.right.in {
position: fixed;
/*width: 100%;*/
}
<script src="http://code.jquery.com/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="form-group">
<div class="row">
<label class="col-xs-2 control-label">Name</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="name" data-toggle="tooltip" title="Lorem ipsum dolor" data-placement="right" />
</div>
</div>
</div>
Upvotes: 0
Reputation: 115212
Apply css white-space: nowrap;
which suppress line break within string.
.tooltip{
white-space: nowrap;
}
.tooltip {
white-space: nowrap !important;
}
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tooltip.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<script>
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<div class="form-group">
<label class="col-xs-2 control-label">Name</label>
<div class="col-xs-5">
<input type="text" class="form-control" name="name" data-toggle="tooltip" title="Lorem ipsum dolor" data-placement="right" />
</div>
</div>
</body>
</html>
Upvotes: 2