I developed a search form with css and jQuery for when i click in my submit button the input box expands.
In google chrome everything is work fine..
But in mozilla firefox When I click in the button to expand, the input expands with a border right and then when the input contracts the button stays with the red border in the left.
I´m trying to solve this with outline none in my #test but its not working...
Anyone there know How I can solve this in mozilla?
My html:
<li id="sb-search" style="float:right; list-style:none; height:20px;">
<div id="search-container">
<span id="search" class="form-container cf">
<form name="form1" >
<input id="test" type="search" placeholder="Search..." required="required" onblur="if(this.placeholder == ''){this.placeholder ='Search...'}" />
<button class="expand" type="submit"><i class="fa fa-search"></i></button>
</form>
</span>
</div>
</li>
My css:
#test
{
font-family:'bariolthin';
font-size:17px;
line-height:18px;
outline:none;
border:0;
}
.form-container input
{
width: 150px;
height: 30px;
float: left;
font: bold 15px;
font-size:15px;
font-family:'bariol_lightlight';
border: 0;
background: #f3f3f3;
border-radius: 3px 0 0 3px;
color:#000;
margin-top:8px;
display:none;
outline:none;
}
.form-container button
{
overflow: visible;
position: relative;
float: right;
border: 0;
padding: 0;
cursor: pointer;
height: 30px;
width: 35px;
text-transform: uppercase;
background: #141d22;
border: 3px solid #141d22;
border-radius: 5px;
text-shadow: 0 -1px 0 rgba(0, 0 ,0, .3);
margin-top:8px;
outline:none;
border:none;
}
My jQuery:
$(function() {
$('button.expand').click(function(event) {
$('#test').width(0).addClass('visible').show().animate({width: 180}, 500);
event.stopPropagation();
});
$('#test').click(function(event) {
$('#test').width(180);
event.stopPropagation();
});
$('html').click(function() {
if($('#test').hasClass("visible")){
$('#test').width(180).show().animate({width: 0}, 500).removeClass("visible");
}
});
});
You have to reset box-shadow.
#test {
font-family:'bariolthin';
font-size:17px;
line-height:18px;
outline:none;
border:0;
box-shadow:none;
}
Related
I have a form in which I want to show the input text field and submit on the same line. The input text field has two FontAwesome icons which I want to show inside the text field. I can style the form as I want when I don't use the easy Autocomplete plugin. But when I activate the easyAutocomplete plugin, the styling goes haywire.
Here's the code:
HTML:
<form role="search" method="get" id="searchform" class="searchform" action="">
<span class="fa fa-map-marker my-fa"></span>
<input type="text" value="" name="s" id="search-input" class="s" placeholder="Enter your Postcode" autocomplete="off">
<img id="slider-loading" class="loading" src="https://www.imageupload.co.uk/images/2017/02/05/gps2.gif" />
<input type="hidden" value="profile" name="post_type" id="post_type" />
<input type="hidden" value="country" name="taxonomy" />
<input type="submit" id="searchsubmit" value="GO" class="submit btn" />
</form>
jQuery
var options = {
data: ["Cyclops", "Storm", "Mystique", "Wolverine", "Professor X", "Magneto"],
theme: "dark"
};
$("#search-input").easyAutocomplete(options);
CSS:
.searchform {
position: relative;
text-align: center;
}
.searchform input[type="text"] {
width: 400px;
font-size: 15px;
margin: 0px -3px 0px 0px;
text-indent: 18px;
padding: 15px;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 300;
font-family: 'Raleway', sans-serif;
border: solid 1px #bbb;
overflow: hidden;
border-radius: 4px;
}
.searchform input[type=text],
.searchform input[type=text]:focus {
outline: none;
}
.searchform input[type=text]:focus {
border: none;
}
.searchform input[type="submit"] {
background-color: #f70808;
-webkit-box-shadow: 0 2px 0 #c60606;
-moz-box-shadow: 0 2px 0 #c60606;
box-shadow: 0 2px 0 #c60606;
color: white;
border: none;
letter-spacing: 1px;
padding: 15px;
font-size: 15px;
text-align: center;
}
.searchform input[type="submit"],
.searchform input[type="text"] {
line-height: normal !important;
display: inline-block;
}
.my-fa {
font-family: 'FontAwesome';
position: absolute;
z-index: 2;
color: #f70808;
font-size: 2.8em;
margin-left: 4px;
top: 4px;
}
#slider-loading {
position: relative;
top: 12px;
right: 35px;
}
I want to show the map icon on the left of the input text field and and the loading spinner on the right of the input text field.
JSFiddle - with easyAutocomplete plugin
JsFiddle - without the plugin
You could add the following code to your CSS:
.easy-autocomplete{
display:inline;
}
I think it gives you the desired outcome.
The plugin wraps the input in a div which by default have display:block and it throws the other elements out of line.
You may need to adjust the padding/margin to your preference.
See updated fiddle
I'm trying to combine three form elements (input, select & submit) into a single bar for a search, it is obvious what I'm trying to do from this jsfiddle:
https://jsfiddle.net/0deLogqp/1/
html:
<div class="form-wrap">
<form action="/search" method="get">
<input type="text" name="q" placeholder="Search..." required class="search-box">
<select>
<option selected>All countries</option>
<option>Australia</option>
<option>Denmark</option>
<option>USA</option>
</select>
<input type="button" value="Search" class="search-button">
</form>
</div>
css:
/* combo search box */
form {
margin:50px auto;
}
.form-wrap {
display: inline;
}
.search-box {
width:150px;
padding:8px 15px;
background:rgba(50, 50, 50, 0.2);
border:2px solid #8FD926;
font-size: 28px;
display: inline-block;
}
.search-button {
position:relative;
padding:6px 15px;
left:-8px;
border:2px solid #8FD926;
background-color:#8FD926;
color:#fafafa;
font-size: 28px;
display: inline-block;
}
.search-button:hover {
background-color:#fafafa;
color:#8FD926;
}
select {
width:120px;
padding:8px 15px;
background:rgba(50, 50, 50, 0.2) url({% static 'images/caret.png' %}) no-repeat right center;;
border:2px solid #8FD926;
height:50px;
font-size: 12px;
-webkit-appearance: none;
-webkit-border-radius: 0px;
display: inline-block;
}
(I know my css repeats, I unpacked it for testing).
Just in case there's any doubt, you can see a working example here: http://www.opencorporates.com
I want to stick to CSS only and avoid javascript (if possible).
As provided by Paulie_D:
/* combo search box */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
form {
margin:50px auto;
}
.form-wrap {
display: inline;
font-size:0; /* whitespace remover */
}
form > * {
vertical-align: middle;
height: 50px;
}
.search-box {
width:150px;
background:rgba(50, 50, 50, 0.2);
border:2px solid #8FD926;
font-size: 28px;
display: inline-block;
}
.search-button {
position:relative;
border:2px solid #8FD926;
background-color:#8FD926;
color:#fafafa;
font-size: 28px;
display: inline-block;
}
.search-button:hover {
background-color:#fafafa;
color:#8FD926;
}
select {
width:120px;
background:rgba(50, 50, 50, 0.2) url({% static 'images/caret.png' %}) no-repeat right center;;
border:2px solid #8FD926;
font-size: 12px;
-webkit-appearance: none;
-webkit-border-radius: 0px;
display: inline-block;
}
I am having this really weird issue where I cannot highlight my text in my form fields.
I cannot seem to figure out what the issue is, since everything but that seems to be working correctly.
I can't seem to understand where the problem lies - it doesn't work on Chrome or Safari.
{
position:relative;
width:100%;
margin-bottom:-20px;
}
.outerForm img {
width:800px;
text-align: center;
margin-left: auto;
margin-right: auto;
}
form {
display: table;
position:absolute;
top:0px;
left:0px;
right:0px;
margin-left: auto;
margin-right: auto;
color:black;
width:600px;;
height:300px;
margin-top: 100px;
}
.innerForm > input, .innerForm > label {
display: inline-block;
vertical-align: top;
margin-left: 5px;
margin-top: 25px;
margin-right: 5px;
}
.innerForm > label {
width:70px;
text-align: left;
}
#messageLabel {
}
input[type="text"] {
width:200px;
height:30px;
border:none;
outline:none;
box-shadow: none;
background-color:transparent;
border-bottom: 1px solid black;
}
textarea {
resize: vertical;
width:85%;
border:none;
outline:none;
box-shadow: none;
background-color: transparent;
padding-bottom: 18%;
border-bottom: 1px solid black;
margin-top: 20px;
}
textarea:focus {
border:none;
outline:none;
background-color: transparent;
box-shadow: none;
border-bottom: 1px solid red;
}
.innerForm > h4 {
margin-bottom:-10px;
text-transform:none;
font-family: 'Novecento sans wide';
}
input[type="text"]:focus, input[type="textarea"] {
border:none;
outline:none;
background-color:transparent;
box-shadow: none;
border-bottom:1px solid red;
}
#submitBtn {
background-color:transparent;
color:black;
font-weight:400;
border:none;
outline:none;
border:2px solid white;
padding:10px 20px 10px 20px;
font-size: 15px;
margin-top:15px;
transition: all 0.5s ease;
}
#submitBtn:hover {
background-color: #0080ff;
color:white;
}
<div class="outerForm">
<img id="cardImage" class="img-responsive" src="PlayingCardTemplate.png"/>
<form id="contactForm" action="Contact.php" method="POST">
<div class="innerForm">
<h4>Arshdeep Soni</h4>
<label id="nameLabel" for="name">Name:</label>
<input id="name" name="name" type="text"/>
<label id="phoneLabel" for="phone">Phone:</label>
<input id="phone" name="phone" type="text"/>
<label id="emailLabel" for="email">Email:</label>
<input id="email" name="email" type="text"/>
<label id="occasionLabel" for="occasion">Occasion:</label>
<input id="occasion" type="text" name="occasion"/>
<label id="messageLabel" for="message">Message:</label>
<textarea id="message" name="message" ></textarea>
<input type="submit" value="Submit" id="submitBtn" name="submit"/>
</div>
<p id="feedback"></p>
</form>
</div>
Look for ::selection inside the CSS Stylesheet.
An imported stylesheet or a theme might be include ::selection{background:transparent
for multiple reasons.
looking for that class and editing it can be solve the issue.
Also you can add color: in order to color the text inside your selection.
For mozilla use ::-moz-selection
I am trying to align a form text input and button horizontally on the same line while giving the button a minimum width for a responsive layout. For some reason the minimum width forces the button on to a new line
.search-container{
width:100%;
border: 1px solid #000;
display:block;
}
.search-text-container {
width:90%;
display:inline-block;
}
.search-text-container input {
width:100%;
height:30px;
}
.round-icon-container {
width:10%;
display:inline-block;
}
.round-icon-button {
min-width:30px;
display:block;
width:30px;
height:30px;
line-height:normal;
border: 2px solid #f5f5f5;
border-radius: 50%;
color:#f5f5f5;
text-align:center;
text-decoration:none;
background: #464646;
box-shadow: 0 0 3px gray;
font-weight:bold;
}
.round-icon-button:hover {
background: #262626;
}
<div class="search-container">
<span class="search-text-container">
<form action="">
<input type="text" name="fname" />
</form>
</span>
<span class="round-icon-container">
<button type="submit" class="round-icon-button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
I have a fiddle here of what I am working on http://jsfiddle.net/dnssmw83/19/ any help would be much appreciated
You could achieve it by using CSS #media queries like this:
JSFiddle - DEMO
* {
box-sizing:border-box;
}
#media(max-width:320px) {
.search-text-container {
width:70% !important;
}
.round-icon-container {
width:30% !important;
}
}
.search-container {
width:100%;
border: 1px solid #000;
display:block;
font-size: 0; /* to remove the space between inline-block elements */
}
.search-container > span {
font-size: 16px; /* add the font-size to child span elements */
vertical-align: middle;
}
Here is my code
Here i used "hover" of CSS to change the button image font color when mouse pointer is on button image...now i need to change the Image color OR font color when i click on button image...
So help me to give this requirement to my button image....
CSS code for button image :
<style>
.button {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:white;
padding: 2px 8px;
}
.button:hover {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:black;
padding: 2px 8px;
}
</style>
HTML code :
<td width="84"><input name="login" class="button" id="" type="submit" value="Login" /></td>
Try this
<td width="84"><input name="login" class="button" onclick="this.style.color = 'green';" id="id" type="submit" value="Login" /></td>
Use the following javascript code to change the color of the button class when clicked:
<td width="84"><input name="login" class="button" onclick="changeColor()" id="id" type="submit" value="Login" /></td>
<script>
function changeColor() {
document.getElementById("id").style.color = "green";
}
</script>
you have 2 selectors:
:active when mouse is down
:focus when mouse is released if button keeps the focus.
<style>
.button {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:white;
padding: 2px 8px;
}
.button:hover {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:black !important;
padding: 2px 8px;
background-color:#F00 !important;
}
</style>
CSS:
.button {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:white;
padding: 2px 8px;
}
.button:hover {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:black;
padding: 2px 8px;
}
.buttonhover {
border: none;
background: url('images/btn_login.jpg') no-repeat top left;
color:black;
padding: 2px 8px;
}
Jquery:
$(".button").on('click',function(){
$(this).removeClass('button');
$(this).addClass('buttonhover');
})