I have problem with misbehaving header:
Code looks like this:
<div class="row row-grid">
<div class="col-sm-6 col-md-4 col-lg-4 col-xl-3">
<div class="box">
<div class="col-sm-12">
<h2 class="pull-right"><span class="label label-warning">1</span></h2>
<h3 class="pull-left shadow">
Piotrek z Bagien
<br>
<span><h4 class="gray shadow">Pinta</h4></span>
<span><h6 class="gray shadow">India Pale Ale (Poland)</h6></span>
</h3>
</div>
</div>
<div class="" id="sub-row">
<span class="col-sm-6 white-text">7 zł / 9 zł / 12 zł</span>
<span class="col-sm-6 white-text">5.2%/90 IBU</span>
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 col-xl-3">
<div class="box">
<div class="col-sm-12">
<h2 class="pull-right"><span class="label label-warning">1</span></h2>
<h3 class="pull-left shadow">
Piotrek z Bagien India Pale Ale
<br>
<span><h4 class="gray shadow">Pinta</h4></span>
<span><h6 class="gray shadow">India Pale Ale (Poland)</h6></span>
</h3>
</div>
</div>
<div class="" id="sub-row">
<span class="col-sm-6 white-text">7 zł / 9 zł / 12 zł</span>
<span class="col-sm-6 white-text">5.2%/90 IBU</span>
</div>
</div>
</div>
What I want to achieve is to concat String with "..." if too long or other elegant solution that won't destroy whole layout.
edit: Almost there thanks to answer. Now it looks like this:
and I have two questions:
why left side of the concatenated text lost it's shadow?
how to make it work when screen gets smaller?
You can make trailing dots with something like this:
HTML
<div class="toolong">
this text is just too loooooooooooooooooooooooooong
</div>
CSS:
.toolong {
width: 300px;
overflow:hidden;
white-space:nowrap;
text-overflow: ellipsis;
}
http://jsfiddle.net/jguaxbsg/
Related
I have one row and two columns in it. Right column's content overlaps to left column. Here is my codes.
Even in the large screen I see that (in below code) <div class="row hidden-xs" style="border-bottom: 2px solid lightgray;">
this border overlaps to left.
Here is how it looks
How do I prevent overlapping their contents?
<div class="row">
<div class="col-lg-2" style="letter-spacing: 1px;">
<img src="~/Content/images/kitap/kitap2.jpg" style="width:250px; height:350px;"/>
<h5><b>ISBN:</b>1234567891</h5>
<h5><b>Kapak Türü:</b> Sert Kapak</h5>
<h5><b>Baskı No:</b>16</h5>
<h5><b>Yayınevi:</b>Publishing </h5>
<h5><b>Yıl:</b> 2005</h5>
</div>
<div class="col-lg-10">
<ul class="nav nav-tabs">
<li class="active">Yeni ve 2. El</li>
<li>Kirala</li>
<li>Kitap Detaylı Bilgileri</li>
<li>Kitap Yorumları</li>
</ul>#*nav nav-tabs*#
<div class="tab-content">
<div class="tab-pane active" id="satinAl">
<div class="row hidden-xs" style="border-bottom: 2px solid lightgray;">
<div class="col-md-3">
<h5><b>Fiyat + Kargo</b></h5>
</div>
<div class="col-md-3">
<h5><b>Kitabın Durumu</b></h5>
</div>
<div class="col-md-3">
<h5><b>Tahmini Teslim Tarihi</b></h5>
</div>
<div class="col-md-3">
<h5><b>Satıcı Bilgileri</b></h5>
</div>
</div> #*Başlık 1. row*#
<div class="row">
<div class="col-md-3">
<h5><b>39.87 TL</b></h5>
<h6>3.99 TL Kargo</h6>
</div>
<div class="col-md-3">
<h5><b>Çok İyi</b></h5>
<h6>Kitap çok iyi durumdadır. Çizgi karalam yoktur. Çok iyi müşteri hizmetleri. Alan Memnun</h6>
</div>
<div class="col-md-3">
<h5><b>Feb. 24 - Mar. 3.</b></h5>
<h6>Satıcı İade Politikası</h6>
</div>
<div class="col-md-3">
<h5><b>Jenny Blue</b></h5>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
100% Pozitif
</div>
</div> #*Ilk Satıcı 2. row*#
</div>#*tab-pane active Satın Al*#
<div class="tab-pane" id="kirala">
<p>Çok yakında hizmetinizde</p>
</div>
</div>#*tab-content*#
</div>#*col-md-10*#
</div>#*row*#
To make columns to behave responsively you need to remove fixed dimensions of image:
<img src="~/Content/images/kitap/kitap2.jpg" style="width:250px; height:350px;"/>
and set class="img-responsive" to it:
<img src="~/Content/images/kitap/kitap2.jpg" class="img-responsive"/>
here is a working example
It is because the image is bigger than the column.
You need either to use bootstrap img-responsive class and remove the width and height attributes in img
or
make the cols bigger , ex: use col-lg-4 for the first column and col-lg-8 for the second column.
I am building a website using Twitter Bootstrap. I have divided the page content into 4 parts - 1. is a headline (col-sm-4), 2.,3.,4 are pictures (col sm-2, col-sm-2, col-sm-4). I have made a CSS class to pull pictures down. I want them to be in one row next to the H3 headline Obrazky:. Every browser shows it exactly as I want except for Mozzila which puts those three images next to the whole webpage. I need to fix that.
HTML
<div class="col-sm-4">
<br>
<h3>Obrázky:</h3>
</div>
<div class="col-sm-2 pull-down">
<br><br>
<img src="img/mobil.png" alt="mobil" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na mobilu</strong></p>
<br>
</div>
<div class="col-sm-2 pull-down">
<img src="img/tablet.png" alt="tablet" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na tabletu</strong></p>
<br>
</div>
<div class="col-sm-4 pull-down">
<img src="img/notebook.png" alt="notebook" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na notebooku</strong></p>
<br>
</div>
CSS
.pull-down {
float: none;
display: table-cell;
vertical-align: bottom;
}
Try this:
<div class="container">
<div class="row">
<div class="col-sm-4">
<br>
<h3>Obrázky:</h3>
</div>
<div class="col-sm-2 pull-down">
<br><br>
<img src="img/mobil.png" alt="mobil" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na mobilu</strong></p>
<br>
</div>
<div class="col-sm-2 pull-down">
<img src="img/tablet.png" alt="tablet" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na tabletu</strong></p>
<br>
</div>
<div class="col-sm-4 pull-down">
<img src="img/notebook.png" alt="notebook" class="img-responsive img-center">
<p class="text-center"><strong>Zobrazení na notebooku</strong></p>
<br>
</div>
</div>
</div>
I use bootstrap on my current project, it's working fine but only one glitch:
I have 3 col-sm-6 next to each other, when the second col-sm-6 is longer than the first, third col-sm-6 moves to left and a gap appears between first and third one.
I have 2 points to ask about:
Is it possible / how to remove that gap.
Is it possible / how to fix the third .col-sm-6 .tasks-panel to left.
Here is 2 images demonstrate what problem I have:
Second col-sm-6 is short:
Second col-sm-6 is longer than the first:
My html structure goes like this:
<h4><span data-head-year></span> <span data-head-month></span></h4>
<a class="pull-right" id="today"><div class="btn btn-primary" style="margin:3px">Today</div></a>
</div>
<hr style="margin: 20px 0"/>
<div class="day-headers">
<div class="day header">Mon</div>
<div class="day header">Tue</div>
<div class="day header">Wed</div>
<div class="day header">Thu</div>
<div class="day header">Fri</div>
<div class="day header">Sat</div>
<div class="day header">Sun</div>
</div>
<div class="days" data-group="days">
<!-- the place where days will be generated -->
</div>
</div>
<!-- Responsive calendar - END -->
</div>
Outlets to visit
<div class="template outlet-wrapper" style="display: none">
<div class="outlet-header">
<div class="col-xs-6">
<h4 class="outlet-name"></h4>
</div>
<div class="col-xs-6 text-right">
<h5 class="tools" style="display: none">
<i class="icon-repeat repeat"></i>
<span class="glyphicon glyphicon-remove remove"></span>
</h5>
</div>
</div>
<div class="clearfix"> </div>
<div class="outlet-body">
<div class="col-sm-6">
Time to reach: <spane class="time-to-reach"></spane>
</div>
<div class="col-sm-6">
Time to leave: <span class="time-to-leave"></span>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="panel-footer">
<button class="btn btn-primary pull-right" id="add-outlet"> Add Visit </button>
<div class="clearfix"></div>
</div>
</div>
Tasks List
</div>
<div class="panel-footer">Panel Footer</div>
</div>
Sorry for bad format, I don't know why stackoverflow editor breaks my html code; I have tried (Ctrl + K, <pre><code>) but none of them worked !
If you're interested in seeing my code properly, please show my post in editor.
Thanks in advanced.
Update:
A Codepen is available here, press add visit to see what happens if second column is long.
Have you tried to apply "pull-right" to the "col-sm-6" container of "panel panel-primary outlets-panel"?
<div class="col-sm-6 pull-right">
<div class="panel panel-primary outlets-panel">
<div class="panel-heading">
...
Forked Codepen
You'll still have to fix the above space of the "tasks list" container, but that should be trivial.
I'm using bootstrap for my first major product, I've merely played around with it in the past, now I have the following in my HTML view (this is indicative of the structure and is repeated, it's just an example to show how I have a div.row-fluid and 2 or 1 child divs)
<div id="menuWrapper" >
<div class="row-fluid">
<div class="col-xs-9 menu-detail">
Vorspeisen
</div>
<div class="col-xs-3 selected-orange text-right">
ab 2.80 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Hausgemachter Griebenschmalz auf Schrotbrot
<span class="grey-subtext">Portion mit Spreewald - Gurke</span>
</div>
<div class="col-xs-3 text-right">
3.80 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Hausgemachter Griebenschmalz auf Harzer Käze
<span class="grey-subtext">Portion mit Spreewald - Gurke</span>
</div>
<div class="col-xs-3 text-right">
3.80 €
</div>
</div>
<div class="row-fluid menu-header">
<div class="col-xs-9 menu-detail">
Hauptspeisen
</div>
<div class="col-xs-3 selected-orange text-right">
ab 12.80 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Ragu alla Bolognese
<span class="grey-subtext">mit orginal Parmesan Käse</span>
</div>
<div class="col-xs-3 text-right">
7.80 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Fish & Chips
<span class="grey-subtext">mit orginal Mushy-Erbse </span>
</div>
<div class="col-xs-3 text-right">
10.80 €
</div>
</div>
<div class="clearfix"></div>
<div class="row-fluid">
<div class="col-xs-9">
Beriner Teller
<span class="grey-subtext">Bulette mit Kartoffelsalat, hausgemachter Art mit Jogurt-Dressing und original Spreewalk-Gurke</span>
</div>
<div class="col-xs-3 text-right">
9.80 €
</div>
</div>
<div class="clearfix"></div>
<div class="row-fluid">
<div class="col-xs-9 menu-detail">
Dessert
</div>
<div class="col-xs-3 selected-orange text-right">
ab 2.90 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Alt Deutscher Käsekuchen
</div>
<div class="col-xs-3 text-right">
ab 2.90 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-9">
Alt Britisch Käsekuchen
</div>
<div class="col-xs-3 text-right">
ab 2.90 €
</div>
</div>
<div class="row-fluid">
<div class="col-xs-12 text-center menu-close">
<span class="icon-close"></span>
Close
</div>
</div>
</div>
Now for some reason should I try to add a border-bottom and padding to the class="row-fluid" divs these are not shown, for example I have something like this in my CSS:
#menuWrapper .row-fluid {
padding-top: 5px;
padding-bottom: 5px;
border-bottom: 1px solid black;
}
even if I have no Div with an ID to isolate the styles the styles are not applied. It's as if the contents of the .row-fluid is overflowing out of the DIVs. If I want to add the border or padding on the row I have to apply it to the children divs with the styles class="col-xs-* Obviously I don't want to do this due to the repetition or classes. Does anyone know what I am doing wrong as I have no conflicting css (that I can isolate) that is producing this issue? Perhaps it is a lack of understanding on my part? But even if I remove all my CSS and apply the above css exclusively my view still doesn't produce the border and padding I want?
Try adding overflow:hidden to row-fluid
Fiddle
Css
#menuWrapper .row-fluid {
padding-top: 5px;
padding-bottom: 5px;
border-bottom: 1px solid black;
overflow:hidden;
}
for convenience, you can create your own style file, it has to override properties of an existing class, or create a class with the necessary parameters
<div class="row-flud your klass">
<div class="col-xs-9">
Hausgemachter Griebenschmalz auf Schrotbrot
<span class="grey-subtext"> Portion mit Spreewald - Gurke </ span>
</ div>
<div class="col-xs-3 text-right">
3.80 €
</ div>
</ div>
I'm trying to use Bootstrap 3 to make a grid-based template for a modal (which I'm also using Bootstrap for). The modal appears, and all the content is there ... but the styling is off. It looks like the row classes don't fill their parent containers, even though there's no styling that should make that happen. Here's a screenshot - you can see that neither the row in the header nor the row in the body take the width of their parent. I've tried poking around other SO posts for information, but I can't seem to find anything on why a row wouldn't fill its parent width.
Update:
Here's a JSFiddle. It looks like it actually works on JSFiddle ... which means it's not a problem with the immediate template, so I'm looking into other possible causes. Thanks for the tip, calvin!
HTML
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ht-modal-header">
<h1>
Bombay Teen Challenge
</h1>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<address>
1 Chium Village, Ambedkar Road<br/>
Bandra West<br/>
Mumbai 400052
</address>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<abbr>e: </abbr> kkdevaraj#bombayteenchallenge.org<br/>
<abbr>p: </abbr> +91 22 2604 2242
</div>
</div>
</div>
<div class="modal-body ht-modal-body">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="types">
<span class="prevention-label"></span> Prevention, Education, Teen
</div>
<div class="facebook">
<span class="fa fa-facebook-square fa-2x"></span> BombayTeenChallenge
</div>
<div class="twitter">
<span class="fa fa-twitter-square fa-2x"></span> #BombayTC
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="people">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<label>People: </label>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
Dr. Rama R. Rao<br/>
Monte Hackney
</div>
</div>
</div>
<div class="partners">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<label>Partners: </label>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
None Available
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
LESS
.prevention-label {
width: 24px;
height: 24px;
line-height: 24px;
display: inline-block;
background-color: #4ECDC4;
}
.ht-modal-header {
a {
&:hover, &:focus {
color: white;
}
color: white;
}
color: white;
background: linear-gradient(#ht-teal, darken(#ht-teal, 5%));
background: -webkit-gradient(#ht-teal, darken(#ht-teal, 5%));
background: -o-linear-gradient(#ht-teal, darken(#ht-teal, 5%));
background: -moz-linear-gradient(#ht-teal, darken(#ht-teal, 5%));
}
If you nest rows in columns you must understand that inside a .col-lg-6 .row the whole thing starts new (at 100%) and for you you to fill it have to use .col-lg-12 inside of it.
This snippet should work for you
<div class="col-sm-6">
<div class="people">
<div class="row">
<div class="col-sm-12">
<label>People: </label>
</div>
<div class="col-sm-12">
Dr. Rama R. Rao<br/>
Monte Hackney
</div>
</div>
</div>
<div class="partners">
<div class="row">
<div class="col-sm-12">
<label>Partners: </label>
</div>
<div class="col-sm-12">
None Available
</div>
</div>
</div>
</div>