How to target value option with css? - html

I'm looking for a way to target my value option page 1 of X. It seems this is defined as a value option. Can i just target the div class to move it down the page slightly to align with another element?
Html:
<div class="pager">
<form class="awpcp-pagination-form" method="get">
<table>
<tbody>
<tr>
<td>1</td>
<td>
<select name="results">
<option value="5">5</option>
<option value="10" selected="selected">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
<option value="500">500</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>
Page: https://adsler.co.uk/browse-adsler/

Your question is quite undefined, but assuming you want a way to target the element and based on the provide HTML this are ways to target the specific HTML elements.
/* Pagination container */
.awpcp-pagination-form {
outline: 1px solid purple;
padding: 10px;
}
/* Only the selection within container */
.awpcp-pagination-form select {
outline: 1px solid blue;
}
/* or */
select[name="results"] {
background: red;
}
<div class="pager">
<form class="awpcp-pagination-form" method="get">
<table>
<tbody>
<tr>
<td>1</td>
<td>
<select name="results">
<option value="5">5</option>
<option value="10" selected="selected">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
<option value="70">70</option>
<option value="80">80</option>
<option value="90">90</option>
<option value="100">100</option>
<option value="500">500</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>

If I understand your question you can do this using margins with css.
.divclass{
margin-top: 2%;
}
Something like that might work. You can also try using Flex-Box or Grid.
Good luck!

Related

See the below snippet on the select dropdown click u can see options opening with scroll bar, I want to change the scrollbar styles

In select I had more options so scroll is appearing I am trying to access default scroll and change the style of scroll.
select::-webkit-scrollbar {
width: 7px;
}
select::-webkit-scrollbar-track {
background: #fff;
}
select::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 30px;
}
.selectfield::-webkit-scrollbar {
width: 7px;
}
.selectfield::-webkit-scrollbar-track {
background: #fff;
}
.selectfield::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 30px;
}
and the html code is as below:
<table class="form">
<tr>
<td>
<select name="select" ng-options="item for item in items" ng-model="filter.item" class="selectfield">
<!-I want to access this scroll->
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
<option value="">-Select-</option>
</select>
</td>
</tr>
</table>
I want to access this select scroll bar?
And need to change the default scroll styles?
Is it possible?
Thank you in advance
Use this plugin in your project this is specially for dropdowns then all css in your control.
Select2
I guess your intention is to style the select tag. Try this https://css-tricks.com/styling-a-select-like-its-2019/

bootstrap select elements with fixed width do not display inline

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

Aligning right for the select attribute in html

I am trying to align one of the select attribute in html to the right side of the page. However i was unable to achieve it. I have attached my codes here.
<!DOCTYPE html>
<html>
<body>
<h1>Java Casting</h1>
<h3>From</h3>
<h3 align="right">To</h3>
<select>
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
<select align="right" >
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
</body>
</html>
This is what you are trying to achieve if i'm not mistaken.
.right {
text-align: right;
float: right;
width: 50%;
}
.left {
float: left;
width: 50%;
}
<h1>Java Casting</h1>
<div class="left">
<h3>From</h3>
<select>
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
</div>
<div class="right">
<h3>To</h3>
<select>
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
</div>
You could try <select style="float:right">
<!DOCTYPE html>
<html>
<body>
<h1>Java Casting</h1>
<h3>From</h3>
<h3 align="right">To</h3>
<select>
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
<select style="float:right">
<option value="int">int</option>
<option value="double">double</option>
<option value="long">long</option>
<option value="String">String</option>
</select>
</body>
</html>

How can I align the elements in a table cell (<td>)?

In trying to get the label and select element to align to the right of the row,
I tried this:
<tr>
<td>
<input type="radio" id="ucemployee" name="travelertype"/>UC Employee
<label for="selectcampus">UC Campus:</label>
<select id="selectcampus" title="Please select a campus" align="right">
<option value="pleaseselect">Please Select</option>
<option value="ucsc">UC Santa Cruz</option>
<option value="ucb">UC Berkeley</option>
<option value="ucd">UC Davis</option>
<option value="uci">UC Irvine</option>
<option value="ucla">UC Los Angeles</option>
<option value="ucm">UC Merced</option>
<option value="ucr">UC Riverside</option>
<option value="ucsd">UC San Diego</option>
<option value="ucsf">UC San Francisco</option>
<option value="ucsb">UC Santa Barbara</option>
</select>
</td>
<tr>
...but it doesn't work.
If I do this:
<td align="right">
<input type="radio" id="ucemployee" name="travelertype"/>UC Employee
. . .
<select id="selectcampus" title="Please select a campus">
. . .
...all of the elements align right, including the input radio element (as is to be expected, really), but I want the "radio" to remain aligned to the left.
How can I right align the label and select, while leaving the radio alone?
Do I need to put a "shiv" between the radio and the select, or...???
Here are two simple CSS methods to align-right only selected items in a td.
CSS Flexbox method.
#flex-container {
display: flex;
}
label {
margin-left: auto;
}
/* nonessential decorative styles */
table { width: 100%; }
td { border: 1px dashed black; background-color: aqua; padding: 5px; }
label { margin-right: 5px; }
<table>
<tr>
<td>
<div id="flex-container"><!-- new wrapper -->
<input type="radio" id="ucemployee" name="travelertype" />UC Employee
<label for="selectcampus">UC Campus:</label>
<select id="selectcampus" title="Please select a campus" align="right">
<option value="pleaseselect">Please Select</option>
<option value="ucsc">UC Santa Cruz</option>
<option value="ucb">UC Berkeley</option>
<option value="ucd">UC Davis</option>
<option value="uci">UC Irvine</option>
<option value="ucla">UC Los Angeles</option>
<option value="ucm">UC Merced</option>
<option value="ucr">UC Riverside</option>
<option value="ucsd">UC San Diego</option>
<option value="ucsf">UC San Francisco</option>
<option value="ucsb">UC Santa Barbara</option>
</select>
</div>
</td>
<tr>
</table>
DEMO
Notes:
The content is wrapped in a div so the display value of the td doesn't need to be changed, which could affect the table layout algorithm.
Learn more about flex auto margins here: In CSS Flexbox, why are there no "justify-items" and "justify-self" properties?
CSS inline-block method
#right-align {
display: inline-block;
text-align: right;
width: 95%;
}
/* non-essential decorative styles */
table { width: 100%; }
td { border: 1px dashed black; background-color: aqua; padding: 5px; }
<table>
<tr>
<td>
<input type="radio" id="ucemployee" name="travelertype" />
<div id="right-align">
<label for="selectcampus">UC Campus:</label>
<select id="selectcampus" title="Please select a campus" align="right">
<option value="pleaseselect">Please Select</option>
<option value="ucsc">UC Santa Cruz</option>
<option value="ucb">UC Berkeley</option>
<option value="ucd">UC Davis</option>
<option value="uci">UC Irvine</option>
<option value="ucla">UC Los Angeles</option>
<option value="ucm">UC Merced</option>
<option value="ucr">UC Riverside</option>
<option value="ucsd">UC San Diego</option>
<option value="ucsf">UC San Francisco</option>
<option value="ucsb">UC Santa Barbara</option>
</select>
</div>
</td>
</tr>
</table>
DEMO
Don't understand the actual arrangements you are trying to say but i hope this will help.play with the css and labels to rearrange.
<style>
td{
float:right;
}
select,label[for=selectcampus],label[for=ucemployee]{
float:right;
text-align:left;
}
input[type="radio"]
{
float:left;
}
</style>
<td>
<label for="ucemployee">UC Employee</label>
<input type="radio" id="ucemployee" name="travelertype"/>
<select id="selectcampus" title="Please select a campus" align="right">
<option value="pleaseselect">Please Select</option>
<option value="ucsc">UC Santa Cruz</option>
<option value="ucb">UC Berkeley</option>
<option value="ucd">UC Davis</option>
<option value="uci">UC Irvine</option>
<option value="ucla">UC Los Angeles</option>
<option value="ucm">UC Merced</option>
<option value="ucr">UC Riverside</option>
<option value="ucsd">UC San Diego</option>
<option value="ucsf">UC San Francisco</option>
<option value="ucsb">UC Santa Barbara</option>
</select>
<label for="selectcampus">UC Campus:</label>
</td>
I think you need some CSS.
#test{
float:right;}
http://jsfiddle.net/m4onhxa9/

Customize select into a simple icon

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>