fix cursor input - css

i have this template http://khine.3b1.org/search.html and on the right hand side i have a search input field.
the problem is that the cursor sits before the background image!
how do i shift it to the right by 25px so that it starts after the search_icon.png image. the '.placeholder-field' does not seem to do anything for me!
<div id="topsearch" class="yui3-u-1-8"><!-- topsearch width: 12.5% placeholder-field -->
<table>
<tr>
<td>
Advanced Search
</td>
<td>
<form action=";browse_content" method="get">
<div class="search placeholder-field">
<input name="search_text" type="text">
<input value="Search" class="button" type="submit">
</div>
</form>
</td>
</tr>
</table>
</div>
here is the css:
/**************************************************************************
* Search
**************************************************************************/
#topsearch {
display: inline-block;
margin: 3px 0 0 0;
}
#topsearch .advanced-search {
display: inline-block;
float:right;
margin:0 3px 0 0;
width: 16px;
height: 16px;
text-indent: -9999px;
background: url('/ui/core/resources/advanced_search_icon.png') 0 0 no-repeat;
opacity: .2;
}
#topsearch .search input {
font-size: 100%;
width: 90%;
padding: 5px 2px;
border: 1px solid #DDD;
border-top-color: #CCC;
border-bottom-color: #EAEAEA;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: url('/ui/core/resources/search_icon.png') 5px 50% no-repeat white;
}
.placeholder-field {
left: 25px;
}
#topsearch form input.button {
display: none;
}
what am i missing?
is there a way to improve the template so that it is a bit more fluid?
many thanks

Simply reduce the input width and add padding-left on your input like this :
#topsearch .search input {
padding: 5px 2px 5px 25px;
width: 75%;
}

I've fixed it:
#topsearch form input.button{
cursor: pointer;
height: 30px;
position: absolute;
right: 150px;
width: 30px;
display:block
}
You also have to remove the value property of input:
<input type="submit" class="button" value="" style="position: absolute; cursor: pointer; width: 30px; right: 150px; height: 30px;">

Related

Removing white spacing between stacked elements in CSS

I am trying to remove spacing between elements stacked on each other.
This is what i have:
input[type="text"] {
width: 40%;
height: 30px;
border-radius: 29px;
border-style: none;
padding-right: 100px;
padding-left: 30px;
border-width: 0;
}
input[type="submit"] {
margin-left: -100px;
height: 30px;
width: 100px;
border-width: 0;
border-radius: 29px;
background: blue;
color: white;
-webkit-appearance: none;
}
body {
background-color: black;
}
<br/>
<form>
<label for="fname">First Name</label>
<input type="text" id="fname" name="fname" placeholder="Enter your email"><input type="submit">
</form>
I have tried top:0; and bottom:0; but it does not seem to solve my problem in this example.
Remove padding-top and padding-bottom on input[type="text"]
padding-top: 0px;
padding-bottom: 0px;
input[type="text"] {
padding-top: 0px;
padding-bottom: 0px;
width: 40%;
height:30px;
border-radius: 29px;
border-style:none;
padding-right:100px;
padding-left:30px;
border-width: 0;
}
input[type="submit"] {
margin-left: -100px;
height:30px;
width: 100px;
border-width: 0;
border-radius: 29px;
background: blue;
color: white;
-webkit-appearance: none;
}
body {
background-color: black;
}
<br/>
<form>
<label for="fname">First Name</label>
<input type="text" id="fname" name="fname" placeholder="Enter your email"><input type="submit">
</form>
Remove the top bottom padding of input[type="text"].
input[type="text"] {
width: 40%;
height: 30px;
border-radius: 29px;
border-style: none;
padding-right: 100px;
padding-left: 30px;
padding-top: 0;
padding-bottom: 0;
}
I removed the height property from both elements and added it to the container, the form. Then added display: flex to the form.
form {
height: 30px;
display: flex;
}
input[type="text"] {
width: 40%;
border-radius: 29px;
border-style: none;
padding-right: 100px;
padding-left: 30px;
border-width: 0;
}
input[type="submit"] {
margin-left: -100px;
width: 100px;
border-width: 0;
border-radius: 29px;
background: blue;
color: white;
-webkit-appearance: none;
}
body {
background-color: black;
}
<br/>
<form>
<label for="fname">First Name</label>
<input type="text" id="fname" name="fname" placeholder="Enter your email"><input type="submit">
</form>

Form button not aligned in Firefox

I'm making a search bar with a button next to it.
The button is perfectly aligned with the search bar on Chrome and Opera, but on Firefox the button goes up by a couple of pixels.
I've tried to play with the padding and the margin but it don't seems to work.
Here's my code and what it looks like on Chrome and Firefox :
HTML :
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/fontawesome.min.css" rel="stylesheet">
<form id="gameSearch" action="#">
<input type="text" name="game_search" maxlength="16" placeholder="Search...">
<button class="icon"><i class="fa fa-search"></i></button>
</form>
CSS :
button.icon {
margin-left: -5px;
background-color: #9b59b6;
border: 0 none;
color: white;
font-size: 25px;
width: 75px;
height: 50px;
cursor: pointer;
}
button.icon:hover {
background-color: #8e44ad;
}
input[type="text"] {
border: 0 none;
background-color: #ffffff;
height: 50px;
width: 350px;
font: 25px sans-serif;
padding: 0 0 0 5px;
}
form#gameSearch {
padding: 50px 0;
margin: 0 auto;
width: 430px;
}
What it looks like :
In Chrome
In FireFox
Add vertical-align: top; to the input field:
body {
background: #ddd;
}
button.icon {
box-sizing: border-box;
margin-left: -5px;
background-color: #9b59b6;
border: 0 none;
color: white;
font-size: 25px;
width: 75px;
height: 50px;
cursor: pointer;
}
button.icon:hover {
background-color: #8e44ad;
}
input[type="text"] {
box-sizing: border-box;
border: 0 none;
background-color: #ffffff;
height: 50px;
width: 350px;
font: 25px sans-serif;
padding: 0 0 0 5px;
vertical-align: top;
}
form#gameSearch {
padding: 50px 0;
margin: 0 auto;
width: 430px;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/fontawesome.min.css" rel="stylesheet">
<form id="gameSearch" action="#">
<input type="text" name="game_search" maxlength="16" placeholder="Search...">
<button class="icon"><i class="fa fa-search"></i></button>
</form>

Span display inline-block not working properly

I have a textbox and a validation message assigned to it. I am trying to put the validation message inline to the textbox, but it comes just under it. I have tried different options but none of them is working. Below is the code for the same:
HTML
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
CSS
input[type=text].vtooltips {
position: relative;
display: inline;
}
input[type=text].vtooltips + span.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: inline-block;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
Here is a Demo for the same.
The desired output is:
Any help will be appreciated. Thanks.
The easiest way is to use CSS Flexbox. Make your <span> a flex container instead of inline-block, just like this:
span {
display: flex;
}
Have a look at the snippet below:
/* CSS used here will be applied after bootstrap.css */
input[type=text].vtooltips {
position: relative;
display: inline;
height: 20px;
}
.vspan {
/*position: absolute;*/
display:none;
font-size:12px;
font-family: Arial;
color:white;
border-radius:3px;
background: #DC000C;
width:50%;
height: 20px;
border: 1px solid #6D6D6D;
line-height: 0px;
text-align: center;
/*visibility: hidden;*/
border-radius: 4px;
box-shadow: 2px 2px 0px #AFB1B1;
margin-left:5px;
line-height:15px;
}
.validationInput,
.validationInput:focus,
.validationInput:hover {
background-color: #FFFFE0!important;
border: 1px solid red!important;
height: 20px
}
.wrap span:first-child {
display: flex;
position: relative;
overflow: hidden;
width: 100%
}
.wrap span:first-child .input-holder:after {
content: '';
position: absolute;
top: -5px;
right: -5px;
width: 0;
height: 0;
border-width: 5px;
border-color: red;
border-style: solid;
transform: rotate(45deg);
box-shadow: 0 0 0 1px #FFFFE0
}
body {
margin: 30px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-lg-3 wrap">
<span>
<span class="input-holder">
<input type="text" class="mandatoryText vtooltips form-control textbox validationInput" style="width: 100%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName"></span>
<span class="vspan" style="display: inline-block;">Please enter Name</span>
</span>
</div>
Hope this helps!
Please do below changes :
<div class="col-lg-3 wrap">
<span>
<input class="mandatoryText vtooltips form-control textbox validationInput" style="width: 70%; vertical-align: top; border-radius: 4px;" maxlength="100" name="tradeName" type="text">
<span class="vspan" style="display: inline;">Please enter Name</span>
</span>
</div>
please refer Demo from here :
Just add below css..
span.vspan{
margin-top: 5px;
display: flex;
}
.wrap span:first-child {
display: flex;
}

CSS: Input fields with submit buttons styling

I am currently working with an input field that will do search for my page. But I am undergoing some css styling issues. I have placed inside the input field the submit button which is an image of a magnifying glass. the problem is that the button does not stay in its place through cross browsers. It looks ok in firefox but others browsers it looks bad.
How can i get the submit button to stay inside the input field at all times? EXAMPLE
thank you!
CSS related to object
<style>
.search-input {
padding: 0 5px 0 22px;
border: 2px solid #DADADA;
height: 30px;
font-size: 12px;
line-height: 30px;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
background: #FFF; /* old browsers */
}
.search-input li {
list-style: none outside none;
}
.search-submit {
width: 13px;
height: 13px;
border: none;
background: url(http://webprolearner2346.zxq.net/css-test2/images/mag-glass.png) no-repeat;
display: block;
position: absolute;
right: 170px;
text-indent: -9999em;
top: 60px;
}
.search{
float: right;
margin-right: 30px;
margin-top: 35px;
}
</style>
HTML
<div id="header">
<div class="search"><input type="text" class="search-input" name="search" value="Search"/><input type="submit" class="search-submit" /></div>
</div>
Use this much better approach I came across. It works well and tested with web developer tools. Cheers#!!!
HTML
<div id="header">
<form id="search">
<input id="searchField" type="text" />
<input id="searchSubmit" type="submit" value="" />
</form>
</div>
CSS
#search{
float: right;
margin-right: 30px;
margin-top: 35px;
}
#searchField{
border: 1px solid #FFEDE8;
float: left;
height: 20px;
padding-right: 25px;
width: 140px;}
#searchSubmit{
background: url("http://webprolearner2346.zxq.net/css-test2/images/mag-glass.png") no-repeat scroll 0 0 transparent;
border: medium none;
cursor: pointer;
height: 20px;
margin-left: -22px;
margin-top: 5px;
width: 20px;
}

Margins and Padding for Forms Not Responding in IE8

We're coming to the end of a huge site redesign, so I'm testing and checking, cross-browser and all that. I was so proud of my beautiful forms with image hovering and checked it in IE8 only to see that the padding and margin for the text was all messed up.
Here's a link to an image displaying the problem: http://i.imgur.com/F6zPP.jpg
It's not a huge deal, just extremely annoying from a designer's point of view and probably the user's too.
Here's a jsfiddle to see what the form looks like: http://jsfiddle.net/kennyk3/qL96P/
And here's the HTML/CSS for the form:
<div id='account'>
<form id='login' action='signin.php' method='post' accept-charset='UTF-8'>
<fieldset class='topform'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div id='front_login_text'>
<label for='email'>Email:</label>
<input type='text' name='email' id='email' class='textInput' maxlength='50' />
<label for='password'>Password:</label>
<input type='password' name='password' id='password' class='textInput' maxlength='50' />
</div>
<input type='submit' name='Submit' value='' class='loginsubmit' />
<p class='remtext'><input type='checkbox' class='rememberme' name='remember' value='remember' />Remember me on this computer</p>
<p class='notamember'><strong>Not a Member?</strong> <a href='/register.php'>Sign Up Today!</a></p>
</fieldset>
</form>
<p class='forgotpw'>Forgot Your Password? <a href=''><strong>Click Here to Reset it.</strong></a></p>
</div>
<div class='break'></div>
<div id='button'>
<a href='' class='toursprite' title='Take the Tour'>Take the Tour</a>
</div>
.topform {
padding: 60px 0 0 20px ;
border: none;
}
.textInput
{
width: 190px;
height: 39px;
background: url(../images/textfield-bg.png) no-repeat;
border: none;
color: #929292;
padding: 0 20px 0 10px;
margin: 5px 0 0 0;
overflow: hidden;
}
.textInput:hover {
background: url(../images/textfield-hover.png) no-repeat;
}
#account label {
float: left;
text-align: right;
width: 60px;
font-size: 14px;
margin: 12px 10px 0 0;
color: #929292;
}
#account fieldset {
width: 300px;
}
#front_login_text input:focus, #front_login_text textarea:focus {
outline: 0;
background: url(../images/textfield-hover.png) no-repeat;
}
#side_login_text input:focus, #side_login_text textarea:focus {
outline: 0;
background: url(../images/textfield-hover-small.png) no-repeat;
}
#side_optin_text input:focus, #side_optin_text textarea:focus {
outline: 0;
background: url(../images/textfield-hover-small.png) no-repeat;
}
.loginsubmit {
float: right;
margin: 10px 5px 0 0;
width: 70px;
height: 35px;
background: url(../images/login-btn.png) center no-repeat;
border: 0 none;
cursor: pointer;
}
.loginsubmit:hover {
float: right;
margin: 10px 5px 0 0;
width: 70px;
height: 35px;
background: url(../images/login-btn-hover.png) center no-repeat;
border: 0 none;
cursor: pointer;
}
.loginsubmit:active {
float: right;
margin: 10px 5px 0 0;
width: 70px;
height: 35px;
background: url(../images/login-btn-active.png) center no-repeat;
border: 0 none;
cursor: pointer;
}
When dealing with cross browser compatible forms. Make sure you define line-height for the fields. It can make all the difference and may fix your inconsistencies.
If you set the line-height to be something like 200% or 250%, it should still display in the center for Chrome and in IE should be much closer to the center. I just tried it on your forms.
It's not as clean as a browser specific CSS fix, but it might serve your needs.
.textInput
{
width: 190px;
height: 39px;
background: url(http://i.imgur.com/sEdWU.png) no-repeat;
border: none;
color: #929292;
padding: 0px 20px 0 10px;
margin: 5px 0 0 0;
overflow: hidden;
line-height:220%;
}
IE8 reads margins funny and sometimes collapses them. Rather than redoing anything do this CSS hack:
.textInput
{
width: 190px;
height: 39px;
background: url(http://i.imgur.com/sEdWU.png) no-repeat;
border: none;
color: #929292;
padding: 0 20px 0 10px;
margin: 5px 0 0 0;
padding: 10px 20px 0 10px\9;
overflow: hidden;
}

Resources