Weird overflow issue in Twitter Bootstrap and Chrome - css

I have a Twitter Bootstrap well, which contains a Select2 component.
Demo can be viewed at http://jsfiddle.net/U4KTM/1/
There are two problems in Chrome (not evident in FF or IE):
There is an overflow issue in chrome causing vertical scrollbars in the well. This seems to be solved by the following css:
.tab-content {
overflow: hidden;
}
The second problem in Chrome is that selecting an item in the bottom dropdown causes a weird jumping issue in the well, and then some of the well content dissapears off the top.
The code in question is as follows:
<div class="well">
<ul class="nav nav-tabs">
<li class="active">First tab</li>
<li class="">Second tab</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel1">
<div class="control-group">
<label for="bar" class="control-label"></label>
<div class="controls">
<select name="bar" class="selector">
<option value="0">First Option</option>
<option value="1" selected="selected">Second Option</option>
<option value="2">Third Option</option>
</select>
</div>
</div>
<div class="control-group">
<label for="bar" class="control-label"></label>
<div class="controls">
<select name="bar" class="selector">
<option value="0">First Option</option>
<option value="1" selected="selected">Second Option</option>
<option value="2">Third Option</option>
</select>
</div>
</div>
</div>
</div>
</div>

Try to overwrite this CSS class .tab-content:
with:
.tab-content {
overflow:visible;
}
The style is located in :
http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css
line: 608

I ran into this issue as well. Seems you need to make a slight change to the select2.js and comment out the height in the _makeMaskCss. This seem to happen with Bootstrap Responsive for me. The demo seems to work just fine.
function _makeMaskCss() {
return {
width : Math.max(document.documentElement.scrollWidth, $(window).width())//,
//height : Math.max(document.documentElement.scrollHeight, $(window).height())
}
}

Related

The drop-down list appears at the very top of the page (after the click)

Here is the preview of the drop down list
Then, when I click on the dropdown to scroll the items
I think it's because I have too many items in the dropdown?
<div class="row row-cols-3 pt-3">
<div class="col text-end">
<!-- Marché -->
<label for="filterForMarkets" class="form-label">Marché</label>
</div>
<div class="col-4">
<select id="filterForMarkets" name="filterForMarkets" style="min-width: 440px" class="form-select" [(ngModel)]="search.market">
<option value="">
Tous les marchés
</option>
<option *ngFor="let m of markets$ | async" [value]="m.marketId">
{{ m.name }}
</option>
</select>
</div>
</div>
If for example, I display 3 items only, I have no problem.
<div class="row row-cols-3 pt-3">
<div class="col text-end">
<!-- Marché -->
<label for="filterForMarkets" class="form-label">Marché</label>
</div>
<div class="col-4">
<select id="filterForMarkets" name="filterForMarkets" style="min-width: 440px" class="form-select" [(ngModel)]="search.market">
<option value="">
Tous les marchés
</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</div>
</div>
Unfortunately, I need my loop, is there a way in css to display my items correctly, please?
Put size in <select ...
<select size="3" id="filterForMarkets" name="filterForMarkets" style="min-width: 440px" class="form-select" [(ngModel)]="search.market">
If didn't work just let me know.plz down votedown right away :)
You can set a max height to your select field using CSS:
select {
max-height: 180px
}
Either create a class and use it instead of using the select global selector but using the global selector will just handle all your select fields which is good too so, You decide!

Firefox Not Rendering Columns in Print View

I have a div with 2 divs inside of it, each with a ul of content, so it looks like two columns in the view. I'm using window.print and css to print these out, Chrome and Safari work fine, but Firefox is turning the 2 columns into 1.
<div class="Sides">
<div class="left side">
<ul>
<li class="List">
<div>
<div>
<div class="circle">
1
</div>
<select>
<option disabled="disabled">
Select
</option>
<option selected="selected" value="1">
1
</option>
</select> <label>Label</label>
</div>
<div class="form">
<div class="A">
<span >A</span><span></span>
</div>
<select >
<option selected="selected" value="A" >
A
</option>
<option value="B" >
B
</option>
<option value="C">
C
</option>
</select><label>Select</label>
</div>
</div>
</li>
<li class="List">
<div>
<div>
<div class="circle">
1
</div>
<select>
<option disabled="disabled">
Select
</option>
<option selected="selected" value="1">
1
</option>
</select> <label>Label</label>
</div>
<div class="form">
<div class="A">
<span >A</span><span></span>
</div>
<select >
<option selected="selected" value="A" >
A
</option>
<option value="B" >
B
</option>
<option value="C">
C
</option>
</select><label>Select</label>
</div>
</div>
</li>
</ul>
</div>
</div>
Here it is on Chrome/Safari:
Here it is on Firefox:
I've tried column-count, column-fill, float (left/right for diff divs), min-width: 0 / min-height: 0, and I can't seem to get the 2 columns to appear.
Anyone have any other suggestions for how to get this to work?
So in case anyone ever runs into this issue again I had to set the #media print to min-width: 0px; in order to get the columns to print out like they should. Then, to get them the width I needed I had to set a width: 500px; (or whatever width you need) to get them to print out like I needed them. Such a strange bug, but it's fixed now!

Chrome CSS failing

Hi I am trying to change the css for a select element, and it works fine in firefox but it doesnt work in google chrome. When I tried to use the Chrome Developer tool, I see that under Styles/Matched CSS Rules the elements height is successfully changed to 30px but when I go to Computed Style the height shows up as 18px but when I click the arrow to get more information it shows that the height should be 30px
#new-job select - 30px
I am new with html/css and chromes developer tools, but it seems like it should be working to me. Here is my code
<div id="new-job">
<form accept-charset="UTF-8" action="/jobs" class="new_job" id="new_job" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="vfKmC+vnnIl/6icDIbDRfZghNR927qmEqTdB9I2OeMQ="></div>
<div class="field">
<label for="job_category">Category</label>
<select id="job_category" name="job[category]"><option value=""></option>
<option value="Bistro Card">Bistro Card</option>
<option value="Dongle">Dongle</option>
<option value="Return">Return</option>
<option value="Catering">Catering</option>
<option value="Other">Other</option></select><br><br>
</div>
<div class="field">
<label for="job_location">Location</label><br>
<input id="job_location" name="job[location]" size="30" type="text">
</div>
<div class="field">
<label for="job_description">Description</label><br>
<textarea cols="40" id="job_description" name="job[description]" rows="20"></textarea>
</div>
<div class="actions">
<input class="button small radius" id="submit-job" name="commit" type="submit" value="create job">
go back
<div id="new-job-errors"> </div>
</div>
</form>
</div>
And heres my CSS
#new-job {
select {height: 30px;}
}
the correct syntax should be
#new-job select {
height: 30px;
}
To select the select element you can use the assigned id, or the tag itself.
An example of both is here - http://jsfiddle.net/9HndG/
In your css, it would look like this:
by id
#job_category{
height:30px;
}
by tag
select{
width:200px;
}
by both
select#job_category{
height:30px;
}
add some style in your <select>
<select id="job_category" name="job[category]" style="height:30px;">...

Twitter Bootstrap: inline selects not aligning

SEE: http://jsfiddle.net/aGy2P/
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<form method="post" action="">
<fieldset>
<div class="control-group">
<div class="controls">
<select class="span6" name="range-from:price" id="price_from">
<option value="">Min Price</option>
<option value="2000">$2K</option>
<option value="4000">$4K</option>
<option value="6000">$6K</option>
<option value="8000">$8K</option>
<option value="10000">$10K</option>
<option value="15000">$15K</option>
<option value="20000">$20K</option>
<option value="25000">$25K</option>
</select>
<select class="span6 pull-right" name="range-to:price" id="price_to">
<option value="">Max Price</option>
<option value="2000">$2K</option>
<option value="4000">$4K</option>
<option value="6000">$6K</option>
<option value="8000">$8K</option>
<option value="10000">$10K</option>
<option value="15000">$15K</option>
<option value="20000">$20K</option>
<option value="500000">$25K+</option>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<select class="span6" name="range-from:model_year" id="model_year_from">
<option value="">Min Year</option>
<option value="1990">1990</option>
<option value="2000">2000</option>
<option value="2005">2005</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
<select class="span6 pull-right" name="range-to:model_year" id="model_year_to">
<option value="">Max Year</option>
<option value="1990">1990</option>
<option value="2000">2000</option>
<option value="2005">2005</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
</div>
</div>
</fieldset>
</form>
</div>
<div class="span8">
</div>
<div class="span2">
</div>
</div>
</div>
</body>
</html>
If you make the result pane wide enough, you'll see the select fields try to go in an inline layout. I'm having a bit of problem with this, but it's not clearly seen in JSFiddle.
My screen shot
<-- from Chrome, aligns correctly
However, in FF and IE, the "Max Year" select is not horizontally aligned with "Min Year"; instead, it's much lower, like this:
<-- from FF
Initially, I thought it may have something to do with the contents of "Min Year" or "Max Year", so I started tweaking them. But nothing fixed it. When I deleted the node for "Min Price" and "Max Price", then "Min Year" and "Max Year" were suddenly OK.
Any ideas what's wrong?
Well the issue is the following:
<div class="span2">
...other code
<div class="span6">
your dropdown
</div>
...other code
</div>
You are trying to put a span6 inside a span2 container, which just isn't big enough to contain that.
You need to change the span2 to a span12 like so:
http://jsfiddle.net/3N754/
Or note that if you want to put two span6 inside a span 2 you need to have more <div class='row-fluid'>
E.g.
<div class="row-fluid">
<div class="span12">
Fluid 12
<div class="row-fluid">
<div class="span6">
Fluid 6
<div class="row-fluid">
<div class="span6">Fluid 6</div>
<div class="span6">Fluid 6</div>
</div>
</div>
<div class="span6">Fluid 6</div>
</div>
</div>
</div>
I also believe the problem is white spaces between elements ( and there is one between the second pair of select tags ). They do really matter in inline and inline-block elements as they force the elements to wrap like words do when hey exceed their containers width. Two simple solutions are, either remove the spaces between elements, or add a white-space:nowrap; rule on the parent element.
First, you put a Jsfiddle that doesn't reproduce your problem (and that has another problem: the widtch is too small), I don't get the point of that.
Anyway, you put span6 on your select: <select class="span6"
But you didn't put them in a <div class="row-fluid"></div>.
This kind of problem is often caused by space between elements.
Because if one element occupies 50% and the second 50% too, a simple space between them makes them bigger than 100%.
Usually you can:
remove spaces / breakline between your elements (in this case, your selects)
set the fontsize to 0 to the container so that spaces "don't occupy spaces". :)
This might not be the solution to your particular case but maybe for others with the same kind of problem.
Let me know.
EDIT:
please look at this modified fiddle: I am using chrome on MacOs and we know results might be different but when I tried your example, every select was on a different line.
In the fiddle here http://jsfiddle.net/3nJYY/1/, I have removed the spaces /breakline between the selects of the first group. Now they are displayed on the same line (what you were looking for), while the selects in the second group are placed on different lines.
here is the important part, note that I've removed any space or breakline between the closing select and the second one:
<div class="control-group">
<div class="controls">
<select class="span6" name="range-from:price" id="price_from">
...
</select><select class="span6 pull-right" name="range-to:price" id="price_to">
...
</select>
</div>
</div>
The bootstrap-combined.min.css file you are including includes Bootstrap Responsive. The compiled responsive styles have very precise width percentages for .span* elements. After playing around with the code and developer tools in Chrome, I was able to see that different browser widths indeed produced different results.
Ex. 1: browser width at least 1200px
Ex. 2: browser width between 786 and 969px
It seems these widths were made for divs without taking into consideration excess width from select boxes.
A css ninja may have a better solution than this. But setting your select width slightly smaller should solve the problem without making the form look too bad.
<style type="text/css">
.row-fluid select.span6 {
width: 48%;
}
</style>
48.0% seemed good to me for select.span6, though since these are native select boxes, width may vary between operating systems. (I am using OSX.) Use different values above and see what works best for all possible browser widths.
Furthermore, if you don't need responsive capabilities (i.e. if you don't care about your site being mobile-optimized), include only the regular bootstrap css. Your site will then be displayed one way for all viewports and you won't have to worry about how it looks on all devices.
I think your problem is that when you apply the .span6 style to a select, the browser will apply the 48,.... percentage size, but then will add some extra-length to render the component, making it too long to fit, and therefore slide under the other one.
As a workaround, I would propose to wrap the select in a div, and apply the .span6 class to the div instead so that you are sure that the browser renders the proper length. Then you would have to add give a width of 100% to your select to fit in your div
http://jsfiddle.net/SkMZ5/2/
example :
<div class="controls">
<div class="span6">
<select style="width:100%" name="range-from:model_year" id="model_year_from">
<option value="">Min Year</option>
<option value="1990">1990</option>
<option value="2000">2000</option>
<option value="2005">2005</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
</div>
<div class="span6 pull-right">
<select style="width:100%" name="range-to:model_year" id="model_year_to">
<option value="">Max Year</option>
<option value="1990">1990</option>
<option value="2000">2000</option>
<option value="2005">2005</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
</div>
</div>

Can I select the size attribute for twitter bootstrap multiple select?

The size attribute doesn't seem to be working with Twitter bootstraps css file. Am I missing something?
<div class="control-group">
<div class="controls" >
<select class="span2" multiple="multiple" id="multiSelect" size="2">
<option>Assigned1</option>
<option>Assigned2</option>
<option>Assigned3</option>
<option>Assigned4</option>
<option>Assigned5</option>
</select>
</div>
It should be working. I think you forgot a class from the container div.
<div class="control-group select optional">
<label class="select optional control-label"> *Category</label>
<div class="controls">
<select name="name" id="id" class="select optional" size="2">
<option value="">1</option>
<option value="">1</option>
</select>
</div>
</div>
Try this example and check how it works out. that's the way i'm using.

Resources