I'm trying to fix an issue with a hoverable span in html. Inside the span element is a html-select option. When I try to select something, the hoverable span disappears.
This issue only occurs in Firefox. In Chrome I don't have this issue.
HTML Part:
<span class="over">
<i class="fa fa-cogs edit"></i>
<div>
<form method="post" accept-charset="utf-8" action="/edit">
<div class="input select">
<label for="select-id">Select</label>
<select name="select_id" id="select-id">
<option value="">-- select --</option>
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
</select>
</div>
</form>
</div>
</span>
SCSS Part:
.over{
margin-right: 0.5em;
&>i{
color: #bbbbbb;
padding: 2px;
}
&>a{
padding: 2px;
display: none;
&:hover{
color: #000;
}
}
&>div{
display: none;
position: absolute;
border: 1px solid #ccc;
margin: 6px 0 0 -20px;
padding: 2px;
background: white;
border-radius: 4px;
min-width: 140px;
z-index: 100;
text-align: left;
input, select{
padding: 0 5px;
line-height: 1.5em;
width: auto;
display: inline-block;
}
label{
margin: -4px 4px;
display: inline-block;
}
}
&:hover{
border: 1px solid;
border-radius: 4px;
&>i{
color: #000;
}
&>a{
display: inherit;
}
&>div{
display: inline-block;
}
}
}
}
In Chrome I can hover over the span item and select a option from the select-element. Even if I leave the hoverable area.
In Firefox I can also hover over the div, but as soon as I leave the hoverable area, the box disappears and I cannot select an Item.
Problem seems to be fixed in Firefox now.
Related
I want to create an input that contains a button that has an arrow down so the user can click on it to open a list or close it. I can't put the button inside the input, what do i miss here?
.input-wrapper {
position: relative;
}
.combobox-input {
font-size: 16px;
font-weight: normal;
color: #4d4d4d;
background: #ffffff;
border: 1px solid #828995;
height: 30px;
padding: 4px 10px;
}
.combobox-arrow {
display: inline-block;
padding: 6px;
border: none;
background-color: white;
background-image: url(...);
width: 25px;
height: 25px;
}
<div className="input-wrapper">
<input className="combobox-input"/>
<button className="combobox-arrow" ></button>
</div>
Try this and see if it suits your need:
(you can modify the snippet code as per your need)
document.getElementById('caret').addEventListener('click', function() {
// your code here if you want to add some logic
});
button#caret {
border: none;
background: none;
position: absolute;
top: 0px;
right: 0px;
}
.input-wrap {
position: relative;
display: inline;
}
<label>List of places<br/>
<div class="datalist-wrap">
<div class="input-wrap">
<input id="placesText" type="text" name="places" list="places"/>
<button id="caret"> ▼</button>
</div>
<datalist id="places">
<label>Select from the list:
<select name="places" id="select">
<option value="A"></option>
<option value="B"></option>
<option value="C"></option>
</select>
</label>
</datalist>
</div>
</label>
For a select element multiple I want to remove the background color of the selected option as I'm indicating the selection with the box before each option.
The intention is give a checkbox style to a select multiple element.
Why using a select multiple?
I'm working in a Angular App and should be useful style a select multiple as a collection of checkboxes. Doing that I will be able to use angular validations, ng-options, etc. I can build the same interface with inputs type checkbox but that imply a lot more of code for the same piece of functionality.
.form-group{
margin: 10px 0 0 20px;
}
select[multiple]{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
overflow: hidden;
box-shadow: none;
}
select[multiple].form-control{
padding: 6px 0 6px 6px;
}
select[multiple] option{
padding: 5px 0 7px 0;
}
select[multiple]:focus{
box-shadow: none;
}
select[multiple]:focus option:checked{
background-color: white;
}
select[multiple] option:before,
select[multiple] option:after{
content: "";
display: inline-block;
position: absolute;
width: 17px;
height: 17px;
left: 0;
margin-left: 12px;
border: 1px solid #ccc;
border-radius: 3px;
background-color: #fff;
}
select[multiple]:focus option:checked:before{
background: white;
}
select[multiple] option:checked:before{
background-color: #319DB5;
border-color: #2c8ca1;
}
select[multiple] option:checked:after{
background-color: gray;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<body>
<div class="container">
<div class="form-group">
<label for="someOptions">Select multiple</label>
<select multiple="multiple" class="form-control" size="10" name="options" required="required" id="someOptions">
<option label="Option 1" value="number:1">Option 1</option>
<option label="Option 2" value="number:2">Option 2</option>
</select>
</div>
</div>
</body>
I think you are looking for this
select[multiple] option:checked { background: none; }
I am trying to put footer at the bottom with a horizontal line just above the footer. But I am not even able to get footer at the bottom. Tried many posts and blogs but I am missing out on something. I am using the base of some blog to create the signup page.
Fiddle
html
<div id="header">
</div>
<div id="main">
<div id="container">
<form action="index.html" method="post">
<p id="form_title" style='color:#808080'>Create an Account</p>
<fieldset>
<legend style="color:#585858">Get started with Your Profile</legend>
<label for="name" style='color:#808080;font-size:14px'>CUSTOM NAME</label>
<input type="text" id="name" name="user_name" style="color:#404040">
<label for="type" style='color:#808080;font-size:14px'>TYPE</label>
<select id="sel-type" name="type">
<option value="frontend_developer">Front-End Developer</option>
<option value="php_developor">PHP Developer</option>
<option value="python_developer">Python Developer</option>
<option value="rails_developer"> Rails Developer</option>
<option value="web_designer">Web Designer</option>
<option value="WordPress_developer">WordPress Developer</option>
</select>
<label for="type" style='color:#808080;font-size:14px'>REGION</label>
<select id="sel-region" name="region">
<option value="frontend_developer">Front-End Developer</option>
<option value="php_developor">PHP Developer</option>
<option value="python_developer">Python Developer</option>
<option value="rails_developer"> Rails Developer</option>
<option value="web_designer">Web Designer</option>
<option value="WordPress_developer">WordPress Developer</option>
</select>
</fieldset>
<button type="submit">Create Profile</button>
</form>
</div>
</div>
<div id="footer">
About
Instructions
Encountered an issue?
</div>
css
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: 'Lato';
background-color: #E8E8E8;
}
#header {
width:100%;
background-color: #27272D;
height: 50px ;
border:1px solid;
position:relative;
}
#main{
border:1px solid;
width:100%;
height:100%;
}
#container{
margin-top: 100px;
border:1px;
}
form {
max-width: 300px;
margin: 10px auto;
padding: 10px 20px;
border-radius: 3px;
background-color: white;
border:1px;
}
#form_title {
margin: 10px 0 30px 15px;
font-size:20px;
}
input[type="text"],
select {
background: rgba(255,255,255,0.1);
border: none;
font-size: 16px;
height: auto;
margin: 0;
outline: 0;
padding: 15px;
width: 100%;
background-color: #e8eeef;
color: #8a97a0;
box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
margin-bottom: 20px;
}
input[type="text"]{
border-radius: 6px;
-moz-border-radius: 6px;
-khtml-border-radius: 6px;
-webkit-border-radius: 6px;
height:44px;
font-size: 14px;
}
select {
padding: 6px;
height: 44px;
border-radius: 2px;
}
button {
color: #FFF;
background-color: #13ABAF;
font-size: 14px;
text-align: center;
font-style: normal;
border-radius: 5px;
width: 96%;
height:44px;
border: 1px solid;
border-width: 1px 1px 3px;
margin-bottom: 10px;
margin-left: 10px;
}
fieldset {
border: none;
}
legend {
font-size: 17px;
margin-bottom: 24px;
}
label {
display: block;
margin-bottom: 8px;
}
label.light {
font-weight: 300;
display: inline;
}
#horizontal-line{
display: block;
margin-top:100px;
margin-bottom: 60px;
width:96%;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
border-color: #F0F0F0;
}
#footer {
position : absolute;
bottom : 0;
height:60px;
margin-top : 40px;
text-align: center ;
font-size: 10px ;
font-family: 'Lato' ;
}
#media screen and (min-width: 480px) {
form {
max-width: 480px;
}
}
For your css, try
#footer {
position: relative;
...
}
Also for the horizontal line just use
<hr>
html tag above footer
(sorry about that, my editing looks awkward because stackoverflow prints out a horizontal line whenever I use that tag)
Also its more simple and if you want minimal changes to css.
http://jsfiddle.net/750h2crz/7/
I would simply use separate tag for footer sec and use Horizontal Rule tag
<div id="footer">
<hr>
<footer>
About
Instructions
Encountered an issue?
<footer>
</div>
Thx
Remove the position: absolute in your style:
#footer {
position: absolute;
/* ... */
}
FIDDLE: https://jsfiddle.net/lmgonzalves/750h2crz/2/
put this in your css, and use a border instead of a horizontal line.
footer {
position: absolute;
bottom: 0;
height: 60px;
border-top-width: 5px;
border-top-style: solid;
border-top-color: #FFF;
}
updated your css with
#footer {
position:fixed;
width:100%; /* fill the whole width of the screen */
border-top:1px solid #aaa; /* you can change to whatever color you want */
padding-top:10px; /* add some spacing between line and links/text */
background:#fff; /* this is important otherwise your background will be transparent, change the color based on your needs */
/* ... your other properties */
}
Also updated you body styling with some padding at the bottom to offset the footer
body {
/* ... your other properties */
padding-bottom:65px;
}
I have a href button that I styled to have a blue padded border.
Here is how it looks.
It is stacking behind the header and the search bar and I cant figure out why.
If anyone can help me out. here is the html code of the 3 divs.
<div id="topnav">
<span>Home » Tutorials » How to show an example</span>
</div>
<div id="main">
<div id="buttons">
<a class="btn" href="">Recent</a>
</div>
<div class="form-main">
<form class="form-wrapper">
<input type="text" id="search" placeholder="Search for tutorials ...">
<select>
<option value="7" selected="selected">All</option>
<option value="1">Newbie</option>
<option value="2">Beginner</option>
<option value="3">Novice</option>
<option value="4">Educated</option>
<option value="5">Expert</option>
<option value="6">Professional</option>
</select>
<input type="submit" value="Search" id="submit">
</form>
</div>
</div>
</div>
Here is the css code:
#topnav {
background-color: #f2f2f2;
border-radius: 5px 5px 0 0;
display: block;
height: 30px;
line-height: 25px;
padding: 5px;
}
#main {
padding: 5px 15px;
}
#buttons {
text-align: center;
}
.form-main {
background-color: #f6f6f6;
border-color: #dedede #bababa #aaa;
border-radius: 3px;
padding: 8px;
}
.btn {
background: none repeat scroll 0 0 #2972a3;
border-radius: 5px;
color: #ffffff;
font-family: Arial;
font-size: 17px;
padding: 10px 20px;
text-decoration: none;
}
You is positioned after the size of its parent, #buttons, which get its height based of the height of your content, which is 20px, but the real height of your is 40px, which means 10px, both top and bottom, will be outside #buttons div.
Try adding display: inline-block to your button class (.btn) to make the parent get the size including the padding.
Check it out here: http://jsfiddle.net/yc31unad/
add display:inline-block; to your button style
.btn {
background: none repeat scroll 0 0 #2972a3;
border-radius: 5px;
color: #ffffff;
font-family: Arial;
font-size: 17px;
padding: 10px 20px;
text-decoration: none;
display: inline-block;
}
I'm admitting right at the start: this is my first attempt at HTML/CSS coding. So please excuse my code's messiness.
I have two problems: 1. When I shrink my browser window small enough to see a scroll bar, my three drop down menus disappear. 2. I am trying to center my button (Find Resources), but can't figure it out. I've tried auto-ing my left and right margins, I tried text aligning, but it messed up the placement of my three boxes (which have a width of 200px).
Thanks for any help someone can offer!
HTML:
<div id="resource-wrapper">
<div id="content">
<p class="resource-p">Welcome to Our Resource Center.</p>
<p class="resource-p">How may we help you?</p>
</div>
<div id=buttons-div>
<div id=select>
<select class="dropdown" name="field_related_brands_nid">
<option value="All" selected="selected">Any</option>
<option value="2511">Sample</option>
</select>
<select class="dropdown-2" name="field_related_technology_nid">
<option value="All" selected="selected">Any</option>
<option value="444">Sample</option>
</select>
<select class="dropdown-3" name="field_resource_type_value_many_to_one">
<option value="All" selected="selected">Any</option>
<option value="multimedia">Sample</option>
</select>
</div>
<div id=buttons>
<img src="Images/Buttons1.jpg" class="resource-image">
<img src="Images/Buttons2.jpg" class="resource-image">
<img src="Images/buttons3.jpg" class="resource-image">
</div>
<button type="submit" class="resource-p1">Find Resources</button>
</div>
</div>
CSS:
#resource-wrapper {
width: 850px;
margin: 0 auto;}
#content {
background-color: #669bcf;
padding: 1px;
width: 100%;}
.resource-p {
text-align: center;
font-size: 30px;
font-family: sans-serif;
color: white;
line-height: 15px}
#buttons-div {
position: relative;
width: 850px;}
#select {
position: fixed;
margin-top: 214px;
width: 850px;}
.dropdown {
width: 160px;
margin-left: 78px;}
.dropdown-2 {
width: 125px;
margin-left: 115px;}
.dropdown-3 {
width: 95px;
margin-left: 148px;}
.resource-image {
margin: 50px 0 0 58px;}
.resource-p1 {
padding: 16px 18px 13px 18px;
margin: 20px;
text-align: center;
font-size: 21px;
font-family: sans-serif;
color: white;
font-weight: bold;
background-color: #669bcf;
border-style: solid;
border-width: 1px 1px 3px 1px;
border-color: #d7e4f4;
border-radius: 5px;}
Your Dropdowns shouldn't stack as nothing is responsive in your site. If they have a set width like width: 800px; They should be fine. However make sure to have all your id's surrounded with a quote:
<div id=buttons-div>
should be
<div id="buttons-div">
To Center your Resource Button:
.resource-p1 {
margin: 12px auto;
text-align: center;
font-size: 21px;
font-family: sans-serif;
color: white;
font-weight: bold;
background-color: #669bcf;
border-style: solid;
border-width: 1px 1px 3px 1px;
border-color: #d7e4f4;
border-radius: 5px;
display: block;
}
DEMO
1) Change #select's position from fixed to absolute
2) Wrap your button in a container and give that container text-align:center
HTML
<div id="find-resources-container">
<button type="submit" class="resource-p1">Find Resources</button>
</div>
CSS
#find-resources-container {
text-align:center
}