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!
Related
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!
I have the following selection boxes that are working with select2 js:
<!-- Selections for the table -->
<div class="form-group row">
<div class="col-xs-2">
<label for="month" class="control-label">Year</label>
<select class="form-control select2" id="year" name="year" data-placeholder="Select a year">
<option value="2015">
xxx
</option>
...
</select>
</div>
<div class="col-xs-2">
<label for="manager" class="control-label">Manager</label>
<select class="form-control select2" id="manager" name="manager" data-placeholder="Select a manager" multiple="multiple">
<option value="2">
xxx
</option>
...
</select>
</div>
<div class="col-xs-2">
<label for="user" class="control-label">User</label>
<select class="form-control select2" id="user" name="user" data-placeholder="Select a user" multiple="multiple">
<option value="87">
xxx
</option>
...
</select>
</div>
</div>
I am using bootstrap 3 and it is strange, when I get a smaller window, the boxes overlap :(. You can see this in the image below.
How can I have bootstrap to make the different select get below each other when there is not enough space and in a line if there is enough space horizontally?
Use below CSS:
.select2{width:100%}
if this not working then you can use:
.select2{width:100% !important}
I'm having an issue with getting my 'Create' button to be right of my dropdownlist. Because the dropdown has a class form-control it makes the width 100% of the space available and so my button wraps underneath. If I remove the class the button sits next to the dropdown.
http://jsfiddle.net/2y39drrh/
Rather than writing a CSS class to override form-control's width, is there a better way? The forms.less file does say to use form-control with <select> elements...
<div class="form-group">
<label class="control-label col-md-1" for="Note_NoteTypeId">Type</label>
<div class="col-md-11">
<select class="form-control" data-val="true">
<option value="">Select...</option>
<option value="3">Option1</option>
<option value="2">Option2</option>
<option value="1">Option3</option>
</select>
<button class="btn btn-success" id="btnCreate" type="button">Create</button>
</div>
</div>
<div class="form-group">
<span class="field-validation-valid text-danger"></span>
</div>
I guess you want something like this?
Example 1
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="input-group">
<select class="form-control" data-val="true">
<option value="">Select...</option>
<option value="3">Option1</option>
<option value="2">Option2</option>
<option value="1">Option3</option>
</select>
<span class="input-group-btn">
<button class="btn btn-success" id="btnCreate" type="button">Create</button>
</span>
</div>
<div class="form-group">
<span class="field-validation-valid text-danger"></span>
</div>
Example 2
<div class="form-inline">
<select class="form-control" data-val="true">
<option value="">Select...</option>
<option value="3">Option1</option>
<option value="2">Option2</option>
<option value="1">Option3</option>
</select>
<input type="button" class="btn btn-success" value="Create">
</div>
I'm not sure why, the code I'm inserting to this post works weird on JSFiddle and SO editor. But it works fine on codepen.io
body {
max-width: 800px;
margin: 0 auto;
padding: 2em;
}
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.0/bootstrap.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row">
<div class="col-md-6">
<select id="vehicle" name="vehicle" class="form-control" data-dropupauto="false">
<option value=""> 1 </option>
<option value=""> 2 </option> <option value=""> 3 </option>
</select>
</div>
<div class="col-md-6">
<button class="btn btn-success" id="btnCreate" type="button">Create</button>
</div>
</div>
See the example in full page. I believe that's the reason why SO editor and JSFiddle shows different results.
I am having trouble implementing a form in Twitter Bootstrap2.
I've set up a JS Fiddle http://jsfiddle.net/manishap/WNSCW/15/
Here is the code:
<div class="container">
<div id="ratingSubectives" class="row-fluid">
<form class="well" >
<fieldset>
<div class="control-group span3">
<label class="control-label" for="select01">Aaaaaaaaaaaa</label>
<div class="controls"><select id="select01">
<option value=""></option>
<option value="A">A</option>
<option selected="selected" value="B">B</option>
<option value="C">C</option>
</select></div>
</div>
<div class="control-group span3">
<label class="control-label" for="select02">Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</label>
<div class="controls"><select id="select02">
<option></option>
<option selected="selected" value="A">B</option>
<option value="B">B</option>
<option value="C">C</option>
</select></div>
</div>
<div class="control-group span3">
<label class="control-label" for="select03">Ccccccccccc</label>
<div class="controls"><select id="select03" disabled>
<option value="A">A</option>
<option value="B">B</option>
<option selected="selected" value="C">C</option>
</select></div>
</div>
<div class="control-group span3">
<label class="control-label" for="select03"> </label>
<div class="controls"><button type="submit" class="btn">Submit</button></div>
</div>
</fieldset>
</form>
</div>
I'm trying to place 3 select controls with labels horizontally across a div. It looks right in English with short labels. However, eventually this is a site that is delivered in multiple languages, and if the labels get long (as in the middle selector), the label text overlaps the text next to it. How do I get the text to wrap?
I tried adding a max-width: 100%, as per another answer and that didn't work. Maybe I put the labels in divs instead of label tags...
Thanks for any suggestions.
Use the word-wrap attribute to break the word:
.control-label {
word-wrap: break-word;
}
I'm trying to get one div to float left, and one div to float right, but have a form in between, the form has 2 select elements(drop down boxes) in it.
I can get it so I have:
Div<------------->Text<------------->Div
but not
Div<------------->Form<------------->Div
If I just have an empty form element than it works like the text, but as soon as I put the 2 selects in then the right div drops down a line, the same happens if I put a textbox(input, type text) in place of the 2 selects.
This is the code I have so far (Note I'm not using stylesheet for the moment, but I will eventually)
<div class="nav" style="text-align:center;">
<div class="prev" style="float:left;">« July</div>
<form method="get" action="" id="form1">
<select id="months" name="month" onchange="javascript:document.getElementById('form1').submit();">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8" selected="selected">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select id="year" name="yr" onchange="javascript:document.getElementById('form1').submit();">
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010" selected="selected">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
</select>
</form>
<div style="float:right;" class="next">September »</div>
</div>
The HTML <form> element is by default a block element like as <div> is. It will always go in its own new line. You need to either display it inline or to float it to left as well. Since the two other div's are already floated, easiest is to just float the form as well. E.g.
<form style="float: left;">
That said, consider placing CSS style in its own CSS file and reference by ID's and classes.
There is a much easier way to do this. Css "display: inline-block" is the easiest thing to use. Contrary to popular belief, it DOES have perfect crossbrowser support if the correct tricks are used. Here is an example: (zoom and *display are to make IE play nice)
<html>
<head>
<style type="text/css">
.element
{
display:inline-block;
zoom:1;
*display:inline;
}
</style>
</head>
<body>
<div class="element">
Stuff in here....
</div>
<form class="element">
<input type="text" name="testInput" />
</form>
<div class="element">
More stuff
</div>
</body>
</html>
The reason is that you have not assigned width property for divs and forms. If you have floated 2 divs, form should also be floated.
<div class="nav" style="text-align:center;">
<div class="prev" style="float:left;width:200px; background-color:#454545">« July</div>
<form method="get" action="" id="form1" style="width:200px; background-color:#454545; float:left">
</form>
<div style="float:right;width:200px; background-color:#454545" class="next">September »</div>
</div>
The width is random given. Use this tool to decide the width value
I had to ditch the floating, as none of the answers really worked (don't want to set widths, jdc0589's answers didn't float the divs left and right, and when I did it broke, and floating the form left obviously made it not in the center) so I had to use absolute positioning:
<div class="nav" style="text-align:center; position:relative;">
<div style="display:inline; position:absolute; top:0px; left:0px; min-width:105px;" class="prev">« July</div>
<form method="get" action="" id="form1">
<select style="" id="months" name="month" onchange="javascript:document.getElementById('form1').submit();">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8" selected="selected">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<select style="" id="year" name="yr" onchange="javascript:document.getElementById('form1').submit();">
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010" selected="selected">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
</select>
</form>
<div style="display:inline; position:absolute; top:0px; right:0px; min-width:105px;" class="next">July »</div>
</div>