<select id="Semester">
<option value="Fall">Fall</option>
<option value="Spring">Spring</option>
<option value="Summer">Summer</option>
</select>
<select id="Year">
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
</select>
<p>
<input class="submit" value="Submit" type="submit" />
</p>
I have this code, which, on StackOverflow is on one line (except for the button). On our CMS, however, each select element shows up on a different line like this:
What can I do to force these all on to one line?
Add display: inline-block to all your elements to make them display in one line:
<select id="Semester" style="display: inline-block;">
<option value="Fall">Fall</option>
<option value="Spring">Spring</option>
<option value="Summer">Summer</option>
</select>
<select id="Year" style="display: inline-block;">
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
</select>
<p style="display: inline-block;">
<input class="submit" value="Submit" type="submit" />
</p>
To me, the best solution is also display: inline-block.
However, if you don't have access to the html template files on your CMS, you can try to insert the following on your .css file:
#Semester, #Year, #Year + p { display: inline-block;}
If it still doesn't work, try adding !important just before the last ;
Related
How can I specify the position of the label to be above the dropdown menu?
E.g.
<form action="/action_page.php">
<label for="cars">Choose a car:</label>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<input type="submit" value="Submit">
</form>
Is there any style argument in <label for="cars">Choose a car:</label> that would place it above the menu?
Thank you!
Because label is an inline element, you can't give it a size unless you change its display option to block or inline-block
<label for="cars" style="display:block;">Choose a car:</label>
MSDN explaination.
So far it worked this way:
Style should include display: inline-block and width: 10em; and the label tag should close after the select tag.
<form action="/action_page.php">
<label for="cars" style="display: inline-block; width: 10em;">Choose a car:
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select></label>
<input type="submit" value="Submit">
</form>
See here
I am still looking for a more thorough explanation to learn from!
I have to connect a tag, three tags and a that contains a slider to a that is connected to a database.
I have made all of the elements but they are in no way connected to each other, and pressing the button does nothing.
Here is the form where the user types their points:
<form id="pointsform">
Points:<input type="number">
</form>
Then I have the user select a subject:
<select id="subject-selection">
<option value="Math">Math</option>
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
<option value="English">English</option>
</select>
Then they choose the year:
<select id="year-selection">
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
</select>
Then they choose the season:
<select id="season-selection">
<option value="Spring">Kevät</option>
<option value="Fall">Syksy</option>
</select>
Then they can choose a value from a slider:
<div class="slidecontainer">
<p id="slider">How strictly did your teacher grade:</p>
<input type="range" min="1" max="100" value="50">
Under all of that there is a button:
<button id="compare-button">Compare</button>
I would like to connect all the user inputted answers to the button, so when I click the button, it interacts with the database.
You simply have to wrap everything into a single form like this:
<form id="pointsform">
<input type="number">
<select id="subject-selection">
<option value="Math">Math</option>
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
<option value="English">English</option>
</select>
<select id="year-selection">
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
</select>
<select id="season-selection">
<option value="Spring">Kevät</option>
<option value="Fall">Syksy</option>
</select>
<div class="slidecontainer">
<p id="slider">How strictly did your teacher grade:</p>
<input type="range" min="1" max="100" value="50">
</div>
<input type="submit" value="Compare">
</form>
Put all the form controls inside the <form> element, not just the <input type="number">.
I need to keep whitespaces in the begining of select options so I'm adding styles: style="white-space: pre, and rendered form is as below:
<select id="doc_category" name="doc[category]" class="form-control select2 form-control">
<option value="32" style="white-space: pre">G1</option>
<option value="33" style="white-space: pre"> p1</option>
<option value="34" style="white-space: pre"> p333</option>
<option value="35" style="white-space: pre">G2</option>
<option value="36" style="white-space: pre"> p3</option>
<option value="37" style="white-space: pre">GłãWNA3</option>
<option value="38" style="white-space: pre"> pod5</option>
</select>
and whitespaces are gone.
Adding instead of <pre> works for me:
<select id="doc_category" name="doc[category]" class="form-control select2 form-control">
<option value="32">G1</option>
<option value="33"> p1</option>
<option value="34"> p333</option>
<option value="35">G2</option>
<option value="36"> p3</option>
<option value="37">GłãWNA3</option>
<option value="38"> pod5</option>
</select>
Preview
place at the beginning OR (which is better since there is no real white-space present then) use padding-left:1em;
You should use option groups for that.
A nice simple example from W3Schools
<select>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
I have the following list (where ... represents more):
<div class="form-group">
<label class="control-label col-sm-2" for="event_End Time">End time</label>
<div class="col-sm-10">
<select class="form-control" id="event_endtime_1i" name="event[endtime(1i)]" required="required" style="width: 20px">
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
...
</select>
<select class="form-control" id="event_endtime_2i" name="event[endtime(2i)]" required="required" style="width: 20px">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
...
</select>
<select class="form-control" id="event_endtime_3i" name="event[endtime(3i)]" required="required" style="width: 20px">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
...
</select>
— <select class="form-control" id="event_endtime_4i" name="event[endtime(4i)]" required="required" style="width: 20px">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
...
</select>
: <select class="form-control" id="event_endtime_5i" name="event[endtime(5i)]" required="required" style="width: 20px">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
...
</select>
</div>
</div>
I want the nice styling that the form-control css declaration offers, but the problem is that it appears to display the select element as a block and not inline, because the result looks like this:
The select elements are supposed to be sitting next to each other but they are not even though I specified a really really small width, just to prove my point:
http://www.bootply.com/rmtvHeYqFa
What is the correct way to display form-control declarations inline in bootstrap, so my select elements sit next to each other nicely?
Simple fix: You can override the .form-control class to use display: inline
.form-control { display: inline; }
Here's a bootply showing the change
I will add though that this will override ALL your .form-control classes in your project, so, you might instead want to give the elements you want inline another class, and give that class the property display: inline instead - you might need to add !important to override bootstrap in this case e.g.
.new__class { display: inline !important; }
But avoid using !important if you can
I have a simple select statement:
<select class="select ui-icon ui-icon-chevron-down" style="width: 10px;height: 19px;" type="position_last">
<option value="" style="display: none"></option>
<option value="5">5</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
I don't want it to show as a normal select, I want to show it as a simple icon.
I'm not that good with CSS, so I don't know if that can be done or not.
How about using additional library
http://silviomoreto.github.io/bootstrap-select/
you just need to include the library and add this code to your javascript
$(".select").selectpicker();
I just found out how.
I just have to make its backround transparent
<select class="select_ticket form-control ui-icon icon-list" style="background-color: transparent; border: medium none;">
<option value="" style="display: none"></option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
</select>