Font Awesome with easyAutocomplete plugin - html

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

Related

How to reposition a misplaced cursor/blinker in the textarea?

I have an issue where the cursor/blinker is right in the top left of the textarea with no margin or whatsoever. I don't know what could be causing this, the other inputs are working fine. Here is a screen shot:
I also wanna know how to change that black border color? I would like the border to stay the same when I click on it. I tried using textarea:focus to get rid of it but it's not working.
Lastly I wanna get rid of this whitish background when a form gets auto-completed, I haven't figured out how to get rid:
HTML:
<form class="form appear appear-hidden" method="post">
<h1>Contact Me</h1>
<div class="name-section">
<input type="name" placeholder="Name" required />
<input type="surname" placeholder="Surname" required />
</div>
<input type="email" placeholder="Email" required />
<textarea
class="message"
type="message"
placeholder="Message"
row="4"
required
></textarea>
<input class="submit" type="submit" placeholder="submit" />
</form>
CSS:
.name-section input {
width: 48%;
margin: 5px;
border: 2px solid white;
padding: 10px;
background-color: transparent;
font-weight: 600;
}
form input {
width: 98%;
margin: 5px;
border: 2px solid white;
padding: 10px;
/* background-color: #000; */
background-color: transparent;
font-weight: 600;
color: white;
font-family: 'Poppins', sans-serif;
}
input::placeholder {
font-family: 'Poppins', sans-serif;
color: white;
font-weight: 600;
}
input:focus {
border: 1px solid white;
}
textarea {
min-height: 100px;
background-color: transparent;
color: white;
font-family: 'Poppins', sans-serif;
width: 98%;
margin: 5px;
border: 2px solid white;
resize: none;
font-weight: 600;
}
textarea::placeholder {
color: white;
padding: 10px;
margin: 10px;
font-weight: 600;
}
Thanks in advance for the help.
You have no padding in your Textaria, try this: remove padding from textarea::placeholder and add padding to .message :
textarea::placeholder {
margin: 10px;
font-weight: 600;
}
.message{
padding:10px;
}
To remove the "black-border-color:
input:focus{
outline:solid 3px blue;
}
I didn't understand what you mean by this: "Lastly I wanna get rid of this whitish background when a form gets auto-completed, I haven't figured out how to get rid:"

inline login form image not display full

HTML :
form {
padding-top: 5px;
text-align: right;
margin-bottom: 15px;
}
form img {
width: 75px;
height: 25px;
margin-left: -5px;
}
form input {
padding: 12px 17px;
border: 0px solid #fff;
background: rgba(0, 0, 0, 0.2);
border-radius: 15px;
width: 155px;
color: #fff;
}
form button,
#btnDaftar,
#btnLivechat {
display: inline-block; background: url(http://jawapoker88.com/img/images/login.png) top left no-repeat; width: 110px; height: 25px; border: none; cursor: pointer;}
#btnDaftar {
background-image: url(http://jawapoker88.com/img/images/daftar.png)
}
form input::-webkit-input-placeholder {
color: #fff;
}
form input:-moz-placeholder {
color: #fff
}
form input::-moz-placeholder {
color: #fff
}
form input:-ms-input-placeholder {
color: #fff;
}
<div class="wrapper">
<form method="post" action="#">
<input type="text" name="username" placeholder="Username" class="SITELOGIN" method="username" />
<input type="password" name="password" placeholder="Password" class="SITELOGIN" method="password" />
<button type="submit" class="SITELOGIN" method="login"></button>
</form>
</div>
CSS
Question : how to display a full image of login button and daftar button?
Here's what it looks like at the moment:
In this case, the easiest thing to do, without setting a height to the buttons, is to just use an img element:
form {
padding-top: 5px;
text-align: right;
margin-bottom: 15px;
}
form input {
padding: 12px 17px;
border: 0px solid #fff;
background: rgba(0, 0, 0, 0.2);
border-radius: 15px;
width: 155px;
color: #fff;
}
form button,
#btnDaftar,
#btnLivechat {
display: inline-block;
border: none;
cursor: pointer;
background:transparent;
vertical-align:middle;
}
form input::-webkit-input-placeholder {
color: #fff;
}
form input:-moz-placeholder {
color: #fff
}
form input::-moz-placeholder {
color: #fff
}
form input:-ms-input-placeholder {
color: #fff;
}
<div class="wrapper">
<form method="post" action="#">
<input type="text" name="username" placeholder="Username" class="SITELOGIN" method="username" />
<input type="password" name="password" placeholder="Password" class="SITELOGIN" method="password" />
<button type="submit" class="SITELOGIN" method="login">
<img src="http://jawapoker88.com/img/images/login.png">
</button>
<a href="#" id="btnDaftar" class="SITELOGIN" method="register">
<img src="http://jawapoker88.com/img/images/daftar.png">
</a>
</form>
</div>
You should add background-size: contain to #header form button, #btnDaftar, #btnLivechat to let the image fit the container. For a prettier end-result, you could also add vertical-align: middle; to make it align right.

Styling the input type="file". How do I display the file path?

I have been trying to style an input type="file" field.
My button is styled but I can't seem to figure out how to get the filepath/file to show when the user selects the file to upload.
Can anyone out there help?
.file-upload {
overflow: hidden;
display: inline-block;
position: relative;
vertical-align: middle;
text-align: center;
color: #fff;
border: 2px solid #707070;
background: #A0A0A0;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
text-shadow: #000 1px 1px 4px;
cursor: pointer;
}
.file-upload:hover {
background: #2FA2FF;
}
.file-upload.focus {
outline: 2px solid yellow;
}
.file-upload input {
position: absolute;
top: 0;
left: 0;
margin: 0;
font-size: 12px;
opacity: 0;
filter: alpha(opacity=0);
z-index: -1;
}
.file-upload span {
position: absolute;
top: 0;
left: 0;
display: inline-block;
padding-top: .45em;
}
.file-upload {
height: 38px;
}
.file-upload,
.file-upload span {
width: 160px;
}
.file-upload-status {
margin-left: 10px;
vertical-align: middle;
padding: 7px 11px;
font-weight: bold;
font-size: 16px;
color: #888;
background: #f8f8f8;
border: 3px solid #ddd;
}
<form action="" method="POST" enctype="multipart/form-data">
<div class="fileupload-buttonbar">
<label class="file-upload"><span>Upload....</span><input name="uploadfile" type="file"> </label>
</div>
</form>
Add a change event to the input field, and then just get it's .value.
Example (using jQuery):
$('input[name="uploadfile"]').change(function(){
var fileName = $(this).val();
alert(fileName);
});
DEMO: http://jsfiddle.net/hjNEC/2/
EDIT: Since the input field is hidden, and the file name is part of that, you're gonna have to display fileName on the page yourself.
You can create a new div to show the file path, and use Javascript in the onchange event to update the path displayed in the div whenever the user selects a file.
<form action="" method="POST" enctype="multipart/form-data">
<div class="fileupload-buttonbar">
<input type="file" name="uploadfile" id="uploadfile" style="display:none" onchange="file_path_display.innerHTML=uploadfile.value"/>
<span class="file-upload" onclick="uploadfile.click()" ondragdrop="uploadfile.dragdrop()">Upload....</span>
<div id="file_path_display"></div>
</div>
</form>

Align checkbox and label

I have a form which code looks like this:
<div id="right_sidebar">
<form id="your_name" name="your_name" action="#" method="post" style="display: block; ">
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" id="name" value="">
<label for="lastname">Last Name</label>
<input type="text" name="lastname" id="lastname">
<label for="msg">Comment <span class="sp"></span></label>
<textarea name="msg" id="msg" rows="7"></textarea>
<input type="checkbox" name="agree">
<label for="agree">Accept the terms</label>
<button class="blue_button" type="submit">Send</button>
</fieldset>
</form>
</div>​
And which is styled with the following CSS:
body {
color: #333;
font: 12px Arial,Helvetica Neue,Helvetica,sans-serif;
}
#right_sidebar {
padding-top: 12px;
width: 190px;
position:relative;
}
form {
background: #EEF4F7;
border: solid red;
border-width: 1px 0;
display: block;
margin-top: 10px;
padding: 10px;
}
form label {
color: #435E66;
display:block;
font-size: 12px;
}
form textarea {
border: 1px solid #ABBBBE;
margin-bottom: 10px;
padding: 4px 3px;
width: 160px;
-moz-border-radius: 3px;
border-radius: 3px;
}
form label a {
display: block;
padding-left: 10px;
position: relative;
text-decoration: underline;
}
form label a .sp {
background: #EEF4F7;
height: 0;
left: 0;
position: absolute;
top: 2px;
width: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 4px solid #333;
}
form button.blue_button {
margin-top: 10px;
vertical-align: top;
}
button.blue_button{
color: white;
font-size: 12px;
height: 22px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
button.blue_button {
background-color: #76C8C6;
border: 1px solid #7798B7;
text-shadow: 1px 1px 0px #567C9E;
}
​As you can see the checkbox is on top of the label. I would like both to be "on the same line". So, it would look like "[ ] Accept the terms". And how would I make that the text is vertically aligned to the checkbox.
How could I do both?
You can see it live here: form, checkbox failing
One option is to amend the style of the label element that follows the checkbox:
​input[type=checkbox] + label {
display: inline-block;
margin-left: 0.5em;
margin-right: 2em;
line-height: 1em;
}
JS Fiddle demo.
This is, however, somewhat fragile as the margins are a little arbitrary (and the margin-right is purely to force the following button to the next line). Also the attribute-equals selector may cause problems in older browsers.
As implied, in comments, by Mr. Alien it is actually easier to target the checkbox itself with this selector-notation:
input[type=checkbox] {
float: left;
margin-right: 0.4em;
}
JS Fiddle demo.
It is because the label has display: block on it. It means that (without a float or hack) it will claim it's own line.
Change it to display: inline-block or leave the display rule away and you're done.
Seeing you did this intentionally for the first two labels, you should give the accept the terms label an id and use form #accepttermslabel {display: inline-block}. This will override the other rules et because it is more specific.
Wrap your checkbox and text within the <label> tag. Works with your current CSS as seen here in this jsFiddle Demo.
<label for="checkbox">
​<input id="checkbox" type="checkbox"> My Label
</label>​​​​​​​​​​​​​​​​​​​​​​​​​​
Forked your fiddle here with one small change. I nested the checkbox inside the label.
<label for="agree"><input type="checkbox" name="agree">Accept the terms</label>
Hope it helps.
All you need to do is add display: inline to the label. Like this:
label[for="agree"] {
display: inline;
}
You may also have to add the following to get the Send button to stay on its own line:
button[type="submit"] {
display: block;
}
That is enough to make it work, but you could also nest the input inside the label, like this:
<label for="agree">
<input type="checkbox" name="agree" />
Accept the terms
</label>
However, most people avoid doing this because it is semantically constricting. I would go with the first method.
Set a class on the checkbox list as follows:
<asp:CheckBoxList ID="chkProject" runat="server" RepeatLayout="Table" RepeatColumns="3" CssClass="FilterCheck"></asp:CheckBoxList>
Then add the following CSS:
.FilterCheck td {
white-space:nowrap !important;
}
This ensures the label stays on the same line as the checkbox.
I had the same problem with bootstrap 3 horizontal-form, and finally found a try-error solution and works with plain html-css too.
Check my Js Fiddle Demo
.remember {
display: inline-block;
}
.remember input {
position: relative;
top: 2px;
}
<div>
<label class="remember" for="remember_check">
<input type="checkbox" id="remember_check" /> Remember me
</label>
</div>
Tried the flex attribute?
Here's your example with flex added:
HTML
<div id="right_sidebar">
<form id="send_friend" name="send_friend" action="#" method="post" style="display: block; ">
<fieldset>
<label for="from">From</label>
<input type="text" name="from" id="from" value="">
<label for="to">To</label>
<input type="text" name="to" id="to">
<label for="msg">Comment <span class="sp"></span>
</label>
<textarea name="msg" id="msg" rows="7"></textarea>
<div class="row">
<div class="cell" float="left">
<input type="checkbox" name="agree">
</div>
<div class="cell" float="right" text-align="left">
<label for="agree">Accept the terms</label>
</div>
</div>
<button class="blue_button" type="submit">Send</button>
</fieldset>
</form>
</div>
CSS
body {
color: #333;
font: 12px Arial, Helvetica Neue, Helvetica, sans-serif;
}
[class="row"] {
display: flex;
flex-flow: row wrap;
margin: 2 auto;
}
[class="cell"] {
padding: 0 2px;
}
#right_sidebar {
padding-top: 12px;
width: 190px;
position:relative;
}
form {
background: #EEF4F7;
border: solid red;
border-width: 1px 0;
display: block;
margin-top: 10px;
padding: 10px;
}
form label {
color: #435E66;
display:block;
font-size: 12px;
}
form textarea {
border: 1px solid #ABBBBE;
margin-bottom: 10px;
padding: 4px 3px;
width: 160px;
-moz-border-radius: 3px;
border-radius: 3px;
}
form label a {
display: block;
padding-left: 10px;
position: relative;
text-decoration: underline;
}
form label a .sp {
background: #EEF4F7;
height: 0;
left: 0;
position: absolute;
top: 2px;
width: 0;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
border-left: 4px solid #333;
}
form button.blue_button {
margin-top: 10px;
vertical-align: top;
}
button.blue_button {
color: white;
font-size: 12px;
height: 22px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
button.blue_button {
background-color: #76C8C6;
border: 1px solid #7798B7;
text-shadow: 1px 1px 0px #567C9E;
}
Flex allows for table style control with the use of divs for example.
The simplest way I found to have the checkbox and the label aligned is :
.aligned {
vertical-align: middle;
}
<div>
<label for="check">
<input class="aligned" type="checkbox" id="check" /> align me
</label>
</div>
<div>
<input class="aligned" type="checkbox" />
<label>align me too</label>
</div>
<div>
<input type="checkbox" />
<label>dont align me</label>
</div>
I know this post is old, but I'd like to help those who will see this in the future. The answer is pretty simple.
<input type="checkbox" name="accept_terms_and_conditions" value="true" />
<label id="margin-bottom:8px;vertical-align:middle;">I Agree</label>

css on different input classes

hello i have the following problem:
i do check my form for some php error messages.
in case of no error i simply have my css setting:
.wrapper #frame form fieldset ul input {
color: #f23;
font-size: 10px;
height: 18px;
padding-left: 5px;
margin-top: 3px;
outline:none;
}
and my focus settings:
.wrapper #frame form fieldset ul input:focus{
color:#fff;
font-weight: bold;
border: 2px solid #fff;
}
okay, now i changed this line:
<input type="text" id="normal" name="1" value=""/>
with adding the class of error:
<input class="err" type="text" id="normal" name="1" value=""/>
the problem is that my settings just take place for my class details on the input fields but not on my focus settings:
.err {
color: #444444;
font-size: 10px;
width: 180px;
height: 18px;
padding-left: 5px;
outline:none;
background-image: url(../images/error.png);
}
.err input:focus{
color:#f23;
font-weight: bold;
border: 2px solid #f23;
}
so if there is someone who could tell me why this does not work i really would appreciate. thanks a lot.
You have a class of error in your HTML, and in your CSS you've set the class to err; if you use the same name consistently (whichever you choose) it should work.
Your current HTML:
<input class="error" type="text" id="normal" name="1" value=""/>
...and CSS:
.err {
color: #444444;
font-size: 10px;
width: 180px;
height: 18px;
padding-left: 5px;
outline:none;
background-image: url(../images/error.png);
}
.err input:focus{
color:#f23;
font-weight: bold;
border: 2px solid #f23;
}
Also, in your CSS you're selecting an input that's a descendant of an element with the err class-name, not an input element with that class-name. So, altogether you should use something like:
<input class="err" type="text" id="normal" name="1" value=""/>
input.err {
color: #444444;
font-size: 10px;
width: 180px;
height: 18px;
padding-left: 5px;
outline:none;
background-image: url(../images/error.png);
}
input.err:focus{
color:#f23;
font-weight: bold;
border: 2px solid #f23;
}