how to evenly space out drop down box? - html

I am trying to evenly space out my drop down box. I want the options to be evenly spaced out whenever the user select a drop down box. I tried using margin and this seems to work but for some reason, I can't get it to push down further enough....
<div class="subscriptionplan">
<select name="subscriptionplan">
<option value="">Choose Subscription Plan 1</option>
<option value="None">None</option>
<option value="Level 1">Level 1</option>
<option value="Level 2">Level 2</option>
<option value="Level 3">Level 3</option>
</select>
<br></br>
<select name="pricing_level1">
<option value="">Choose a price plan for Level 1</option>
<option value="None">None</option>
<option value="100">Monthly:$100</option>
<option value="800">Yearly:$800</option>
</select>
<br></br>
<select name="pricing_level2">
<option value="">Choose a price plan for Level 2</option>
<option value="None">None</option>
<option value="150">Monthly:$150</option>
<option value="1300">Yearly:$1300</option>
</select>
<br></br>
<select name="pricing_level3">
<option value="">Choose a price plan for Level 3</option>
<option value="None">None</option>
<option value="200">Monthly:$200</option>
<option value="1800">Yearly:$1800</option>
</select>
<br></br>
<button type="submit" name="submit">Sign up</button>
</form>
</div>
This is the CSS code:
div.subscriptionplan {
position: absolute;
right: 180em;
bottom: 60em;
}
div.subscriptionplan select{
margin: 180em;
}

em is not equal to px.
div.subscriptionplan {
position: absolute;
right: 180em;
bottom: 60em;
}
div.subscriptionplan select{
margin: 180em;
}
/* ------------------------*/
You did not add the context for absolute position.
assuming that you need css for spacing select boxes side by side please refer below. you can remove br tags.
div.subscriptionplan {
/* position: absolute;
right: 180em;
bottom: 60em;*/
display:block;
width:100%;
}
div.subscriptionplan select{
/* margin: 180em;*/
margin:0.5em;
display:inline-block;
max-width:33.3%;
}

Related

I cannot change position and add spaces between selection tags in html

<div class="selection_menu">
<select name="Island" id="select_island" class="select_island">
<option value="1">Island</option>
<option value="2">West Java</option>
<option value="3">Sumatra</option>
<option value="4">Bali Pupuan</option>
</select>
<select name="type" id="select_type" class="select_type">
<option value="1">Type</option>
<option value="2">Arabica</option>
<option value="3">Robusta</option>
</select>
<select name="process_method" id="select_process" class="select_process">
<option value="1">Process Method</option>
<option value="2">Natural</option>
<option value="3">Honey</option>
<option value="4">Dry Hulled</option>
<option value="5">Wet Hulled</option>
<option value="6">Extended Natural</option>
<option value="7">Full Wash</option>
</select>
<select name="select_quality" id="select_quality" class="select_quality">
<option value="1">Quality</option>
<option value="2">Specialty</option>
<option value="3">Premium</option>
</select>
<select name="select_available" id="select_available" class="select_available">
<option value="1">Availability</option>
<option value="2">Available now</option>
<option value="3">Not yet available</option>
</select>
<select name="select_cp" id="select_cp" class="select_cp">
<option value="1">Cupping score</option>
<option value="2">80-85</option>
<option value="3">85.1-90</option>
</select>
My selection tags are in a div and I tried : align-items: center, justify-content: center, justify-content: space-between. But it simply didn't work.
How do I center them and add even spaces between them?
How do I put even spaces between them and center them in my div?
Firstly you dont need to use flexbox system. The form elements are inline elements and you can use text-align: center. But i dont know you entire css and i write the example by using flexbox.
Add only this to your css:
.selection_menu {
display: flex;
align-items: center;
justify-content: center;
gap: 40px;
}
.select_island {
display: block;
}
With gap can increase or decrease the space between your elements.
.selection_menu {
display: flex;
align-items: center;
justify-content: center;
gap: 40px;
}
.select_island {
display: block;
}
<div class="selection_menu">
<select name="Island" id="select_island" class="select_island">
<option value="1">Island</option>
<option value="2">West Java</option>
<option value="3">Sumatra</option>
<option value="4">Bali Pupuan</option>
</select>
<select name="type" id="select_type" class="select_type">
<option value="1">Type</option>
<option value="2">Arabica</option>
<option value="3">Robusta</option>
</select>
<select name="process_method" id="select_process" class="select_process">
<option value="1">Process Method</option>
<option value="2">Natural</option>
<option value="3">Honey</option>
<option value="4">Dry Hulled</option>
<option value="5">Wet Hulled</option>
<option value="6">Extended Natural</option>
<option value="7">Full Wash</option>
</select>
<select name="select_quality" id="select_quality" class="select_quality">
<option value="1">Quality</option>
<option value="2">Specialty</option>
<option value="3">Premium</option>
</select>
<select name="select_available" id="select_available" class="select_available">
<option value="1">Availability</option>
<option value="2">Available now</option>
<option value="3">Not yet available</option>
</select>
<select name="select_cp" id="select_cp" class="select_cp">
<option value="1">Cupping score</option>
<option value="2">80-85</option>
<option value="3">85.1-90</option>
</select>
if your tag selection-menu is a flex container
you can play with justify-contentproperty with value space-betweenor space-evenly
.selection_menu {
width:100%;
border:solid 1px black;
display:flex;
justify-content:space-between;
}
<div class="selection_menu">
<select name="Island" id="select_island" class="select_island">
<option value="1">Island</option>
<option value="2">West Java</option>
<option value="3">Sumatra</option>
<option value="4">Bali Pupuan</option>
</select>
<select name="type" id="select_type" class="select_type">
<option value="1">Type</option>
<option value="2">Arabica</option>
<option value="3">Robusta</option>
</select>
<select name="process_method" id="select_process" class="select_process">
<option value="1">Process Method</option>
<option value="2">Natural</option>
<option value="3">Honey</option>
<option value="4">Dry Hulled</option>
<option value="5">Wet Hulled</option>
<option value="6">Extended Natural</option>
<option value="7">Full Wash</option>
</select>
<select name="select_quality" id="select_quality" class="select_quality">
<option value="1">Quality</option>
<option value="2">Specialty</option>
<option value="3">Premium</option>
</select>
<select name="select_available" id="select_available" class="select_available">
<option value="1">Availability</option>
<option value="2">Available now</option>
<option value="3">Not yet available</option>
</select>
<select name="select_cp" id="select_cp" class="select_cp">
<option value="1">Cupping score</option>
<option value="2">80-85</option>
<option value="3">85.1-90</option>
</select>
</div>
adding flexbox with display:flex; than justify-content:center; for horizontal align to center all the elements, than column-gap: 5rem; to create spaces between columns
.selection_menu {
margin: 1rem;
display: flex;
justify-content: center;
align-items: center;
/* CHANGE HERE */
column-gap: 5rem;
/* CHANGE HERE */
}
<div class="selection_menu">
<select name="Island" id="select_island" class="select_island">
<option value="1">Island</option>
<option value="2">West Java</option>
<option value="3">Sumatra</option>
<option value="4">Bali Pupuan</option>
</select>
<select name="type" id="select_type" class="select_type">
<option value="1">Type</option>
<option value="2">Arabica</option>
<option value="3">Robusta</option>
</select>
<select name="process_method" id="select_process" class="select_process">
<option value="1">Process Method</option>
<option value="2">Natural</option>
<option value="3">Honey</option>
<option value="4">Dry Hulled</option>
<option value="5">Wet Hulled</option>
<option value="6">Extended Natural</option>
<option value="7">Full Wash</option>
</select>
<select name="select_quality" id="select_quality" class="select_quality">
<option value="1">Quality</option>
<option value="2">Specialty</option>
<option value="3">Premium</option>
</select>
<select name="select_available" id="select_available" class="select_available">
<option value="1">Availability</option>
<option value="2">Available now</option>
<option value="3">Not yet available</option>
</select>
<select name="select_cp" id="select_cp" class="select_cp">
<option value="1">Cupping score</option>
<option value="2">80-85</option>
<option value="3">85.1-90</option>
</select>

It is possible using CSS to change the color of an item from an option input field when hover over? [duplicate]

This question already has answers here:
Change Select List Option background colour on hover
(13 answers)
Closed 2 years ago.
I made this options input field:
My code is this:
#input-diametru {
background-color: #59253b;
color: #ffffff;
border: 1px solid #ffffff;
border-radius: 5px;
width: 67px;
height: 37px;
appearance: none;
/* Remove default arrow */
background-image: url("/Arrow\ Down\ Bold\ Icon.svg");
/* Add custom arrow */
background-repeat: no-repeat;
background-position: 43px;
}
<select name="input-diametru" id="input-diametru">
<option value="0"></option>
<option value="10C">10C</option>
<option value="12">12</option>
<option value="12C">12C</option>
<option value="13">13</option>
<option value="13C">13C</option>
<option value="14">14</option>
<option value="14C">14C</option>
<option value="15">15</option>
<option value="15C">15C</option>
<option value="16">16</option>
<option value="16C">16C</option>
<option value="17">17</option>
<option value="17.5">17.5</option>
<option value="17C">17C</option>
<option value="18">18</option>
<option value="18C">18C</option>
<option value="19">19</option>
<option value="19.5">19.5</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="22.5">22.5</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="60">60</option>
</select>
When a user goes with the mouse over an option, the background color of that option turns blue, as you can see in the picture above. I want to change that color from blue to #79244D for example. Is there a way to do that in CSS?
I found this answer on w3schools, but this involves using JS.
Tested on Chrome Version 87.0.4280.88 and Microsoft Edge 44.18362.329.0 ONLY .
If you add height to your select , this will not work.
#input-diametru {
background-color: #59253b;
color: #ffffff;
border: 1px solid #ffffff;
border-radius: 5px;
width: 67px;
/* height: 37px; */
appearance: none;
background-image: url("/Arrow\ Down\ Bold\ Icon.svg");
background-repeat: no-repeat;
background-position: 43px;
}
option:hover {
background-color: #79244D;
}
<select name="input-diametru" id="input-diametru" onfocus="this.size=10;" onblur="this.size=0;" onchange="this.size=1; this.blur();">
<option value="0"></option>
<option value="10C">10C</option>
<option value="12">12</option>
<option value="12C">12C</option>
<option value="13">13</option>
<option value="13C">13C</option>
<option value="14">14</option>
<option value="14C">14C</option>
<option value="15">15</option>
<option value="15C">15C</option>
<option value="16">16</option>
<option value="16C">16C</option>
<option value="17">17</option>
<option value="17.5">17.5</option>
<option value="17C">17C</option>
<option value="18">18</option>
<option value="18C">18C</option>
<option value="19">19</option>
<option value="19.5">19.5</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="22.5">22.5</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="60">60</option>
</select>

how to change height to drop down box in html?

The problem is I can't change the height of the drop down box in html.for (select->option) I try to apply the style in CSS. It does not works
You can not control the style of option. (see here:https://css-tricks.com/dropdown-default-styling/)
however you can change the font-size and the option will grow
select option{
font-size: 20px;
}
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
It is not possible to change height of 'option'
Only you can change the background-color and color of the 'option' values
You can change the 'select' element height.
You just need to use the height CSS attribute for the select tag.
label select {
height: 100px;
}
<label>
<select>
<option selected>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</label>
<select style="min-height:40px;min-width:100px;">
<option value="">Select1</option>
<option value="">Select2</option>
<option value="">Select3</option>
</select>
You can style the select and option elements usign CSS like this:
select {
height: 200px;
color: red;
}
option {
color: green;
}
Notice that you have to remove the "." before select and option.
This will overwrite any select and option element.
EDIT:
You can also refer to a certain select element by giving to that element a class name, like this:
select.s1{
height: 100px;
}
select.s2{
height: 150px;
}
<select class="s1">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<select class="s2">
<option value="fiat">Fiat</option>
<option value="ferrari">Ferrari</option>
<option value="alfaromeo>Alfa Romeo</option>
<option value="lancia">Lancia</option>
</select>

Background image makes different design

html,
<select id="start_time" name="start_time" class="hasTimeEntry">
<option value="00:00">00:00</option>
<option value="00:30">00:30</option>
<option value="01:00">01:00</option>
<option value="01:30">01:30</option>
<option value="02:00">02:00</option>
<option value="02:30">02:30</option>
<option value="03:00">03:00</option>
<option value="03:30">03:30</option>
<option value="04:00">04:00</option>
<option value="04:30">04:30</option>
<option value="05:00">05:00</option>
<option value="05:30">05:30</option>
<option value="06:00">06:00</option>
<option value="06:30">06:30</option>
<option value="07:00">07:00</option>
<option value="07:30">07:30</option>
<option value="08:00">08:00</option>
<option value="08:30">08:30</option>
<option value="09:00">09:00</option>
<option value="09:30">09:30</option>
<option value="10:00">10:00</option>
<option value="10:30">10:30</option>
<option value="11:00">11:00</option>
<option value="11:30">11:30</option>
<option value="12:00">12:00</option>
<option value="12:30">12:30</option>
<option value="13:00">13:00</option>
<option value="13:30">13:30</option>
<option value="14:00">14:00</option>
<option value="14:30">14:30</option>
<option value="15:00">15:00</option>
<option value="15:30">15:30</option>
<option value="16:00">16:00</option>
<option value="16:30">16:30</option>
<option value="17:00">17:00</option>
<option value="17:30">17:30</option>
<option value="18:00">18:00</option>
<option value="18:30">18:30</option>
<option value="19:00">19:00</option>
<option value="19:30">19:30</option>
<option value="20:00">20:00</option>
<option value="20:30">20:30</option>
<option value="21:00">21:00</option>
<option value="21:30">21:30</option>
<option value="22:00">22:00</option>
<option value="22:30">22:30</option>
<option value="23:00">23:00</option>
<option value="23:30">23:30</option></select>
css,
#start_time {
background: url(/images/startclock_icon_small.gif) no-repeat scroll 1px 1px;
text-indent: 20px;
border-width: 1px 1px 1px 1px;
width: 142px;
}
if i run this it shows like this,
as you can see in the pic, if i put the
background:url attributes
it shows a different design that i dont want.
i want the same design like the right textfield.
if i comment the background : url it shows fine
however, i need this img icon as a background img :(
any good idea????
========================================
fiddle demo
DEMO
=================================
still design that i don't want
Try this :-
#start_time {
background: url(/images/startclock_icon_small.gif) no-repeat scroll 1px 1px !important;
}
Your hasTimeEntry class is overriding your background property.
Put this inline style on element which isn't working.
style="border-color: #ccc !important;"

Multilevel Navigation List With Select Option

i am creating a nested list with "select" "option" and "optgroup"...
Here is my code
HTML
<div class="menu-2_small">
<form name="nav-2">
<select name="SelectURL" onchange="document.location.href=document.nav-2.SelectURL.options[document.nav-2.SelectURL.selectedIndex].value">
<option value="#">Inspiration</option>
<option value="#">Coding</option>
<option id="show-further-option" value="#">Freebies
<optgroup id="further-option">
<option value="#">Textures</option>
<option value="#">Fonts</option>
<option value="#">Brushes</option>
<option value="#">Vectors</option>
<option value="#">Icons</option>
</optgroup>
</option>
<option value="#">Design</option>
<option value="#">Tutorials</option>
<option value="#">Technology</option>
</select>
</form>
</div>
And the CSS
.menu-2_small{
display:block;
width:100%;
height:35px;
background-image:url(imgs/link-bg-small.jpg);
background-repeat:no-repeat;
background-size:100% 100%;
}
.menu-2_small select{
width:70%;
background-image:url(imgs/link-bg-small.jpg);
color:white;
font-size:0.70em;
margin:6px 0 0 1%;
cursor:pointer;
}
.menu-2_small select option{background-image:url(imgs/link-bg-small.jpg);background-repeat:no-repeat;}
.menu-2_small select option:hover{font-weight:bold;}
optgroup{display:none;}
option #show-further-option:hover optgroup{display:block;}
Now the problem is that when I hover over the option with id "show-further-option", optgroup is not being displayed no matter what i try...
How can i do that?
Use 'label' attribute to display optgroup name.
<option id="show-further-option" value="#">Freebies
<optgroup id="further-option" label="further-option">
<option value="#">Textures</option>
....