CSS: Input fields with submit buttons styling - css

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;
}

Related

Input field, move text that is being input

To make room for an icon, I have moved the placeholder text 35px to the right of my input; However, when I start to type in the input field, the text starts behind the icon.
I attempted a bit of googling, but i have yet to find an answer. The search results I've seen regard the placeholder, but it is not what I am having troubles with.
How do I move the text which is being inputted, so it matches that of the placeholder? (form-group__input)
.login {
background-color: $color-white;
width: 30vw;
position: absolute;
#include position-center;
padding: 20px;
}
.login h2 {
color: $color-gray;
font-weight: bold;
}
.login .form-group {
width: 80%;
margin: 10px auto;
position: relative;
}
.login .form-group .form-group__input {
background: none;
border: 1px solid gray;
padding: 10px;
border-radius: 6px;
width: 100%;
}
.login .form-group .form-group__input::placeholder {
padding-left: 35px;
}
.login .form-group__icon {
position: absolute;
left: 15px;
font-size: 22px;
color: gray;
top: 6px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<section class="login">
<h2>Login</h2>
<div class="form-group">
<input type="email" placeholder="someemail#email.com" class="form-group__input">
<span class="form-group__icon"><i class="far fa-envelope"></i></span>
</div>
<div class="form-group">
<input type="password" placeholder="**********" class="form-group__input">
<span class="form-group__icon"><i class="fas fa-lock"></i></span>
</div>
Log In
Create Account
</section>
Plz try this code..
css
.form-group__input {
padding: 10px 10px 10px 40px;
}

Customizing Search bar

I want to make the search bar longer and higher. Lining up with the end of the body (width) and menu (heighth). I looked at other tutorials and questions but I am missing something.
CSS
form input[type="text"] {
height: 45px;
width: 250px;
margin: 0;
padding: 0;
font-size: 15px;
border: 1px solid #CCCCCC;
float: left;
}
HTML
<form name="catsearchform60238" method="post" action="/Default.aspx?SiteSearchID=2433&PageID=/search.html">
<div class="cat_textbox">
<input type="text" value="text field"></input>
<input type="submit" value="Submit"></input>
</form>
Using display: block; is probably what you are looking for.
form input[type="text"] {
display: block;
height: 45px;
width: 250px;
margin: 0;
padding: 0;
font-size: 15px;
border: 1px solid #CCCCCC;
float: left;
}

Trouble with a fixed-fluid-fixed header in html document

I'm trying to create a header bar at the top of a page on my website and I'm having trouble with the layout. Below is my desired result:
goal http://ambiguities.ca/images/goal.png
Here is the html:
<div id="page_wrapper">
<div id="header_wrapper">
<div id="banner_wrapper">
<div id="header_banner">
<div class="header_format">Site Name</div>
</div>
</div>
<div id="user_management">
<div class="header_format">Login / Register</div>
</div>
<div id="user_search">
<form method="post" action="?search">
<input id="search_box" type="search" name="search" autocomplete="off" placeholder="Search..." />
</form>
</div>
</div>
</div>
and the css:
body{
margin:0;
padding:0;
}
#page_wrapper {
width: 100%;
min-width: 800px;
}
#header_wrapper {
width: 100%;
height: 30px;
background-color: #E6E6E6;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1px;
}
#banner_wrapper {
float: left;
width: 100%;
}
#header_banner {
margin: 0 180px 0 160px;
}
#user_management{
float: left;
height: 30px;
width: 160px;
margin-left: -100%;
border-right-color: #D8D8D8;
border-right-style: solid;
border-right-width: 1px;
}
#user_search {
padding-top: 2px;
float: left;
height: 30px;
width: 180px;
margin-left: -181px;
border-left-color: #D8D8D8;
border-left-style: solid;
border-left-width: 1px;
}
#search_box {
height: 26px;
width: 176px;
margin: 0;
}
.header_format {
font-family: Verdana;
font-size: 10px;
text-align: center;
line-height: 30px;
vertical-align: middle;
}
I understand that this might not be the most efficient code. My real problem lies in the fact that in the user_search div when a padding of 2 at the top is added the search box becomes unusable by mouse click. If anyone can help me by pointing me in the right direction or showing me a better way of doing this it would be much appreciated.
First, remove the 'padding-top' value from '#user_search', use the following CSS:
#user_search {
float: left;
height: 30px;
width: 180px;
margin-left: -181px;
border: 1px solid #D8D8D8;
}
Second, add a 'margin-top' value to '#search_box' and that should do the trick.
#search_box {
height: 26px;
width: 176px;
margin: 5px 0 0 0;
}
Demo: http://jsfiddle.net/8Frnq/

eliminate the extra space in the page footer

i am trying to remove the extra line in the page footer, i tried to edit my css but its useless , i have 4 css IDs on the page content , search, button_style and ad which is acting as my footer here , the porblem that i need remove the blue line below the page as you see in the screen shot , here is my code
#content {
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
border: 6px solid #BDF4FC ;
width: 50%;
height: 150px;
margin: 0px auto;
text-align: left;
padding: 15px;
margin-top: 10%;
background-color: #ffffff;
}
#search {
height: 42px;
border: medium solid #63D1F2;
font-size: 24px;
font-style: normal;
color: #CCC;
font-weight: bolder;
vertical-align: middle;
margin-left:7%;
margin-top:7%;
position:relative;
text-indent:10px;
}
#button_style {
background-image: url(images/search_button.png);
height: 44px;
width: 92px;
background-color: #FFF;
border: 0px none #FFF;
vertical-align: middle;
margin-top:7%;
margin-left:1px;
}
#ad {
width:auto;
height:190px;
background-color:#FFF;
margin-top:5%;
border-top-width: 10px;
border-top-style: solid;
border-top-color: #12ADDA;
border-right-color: #EDEDED;
border-bottom-color: #EDEDED;
border-left-color: #EDEDED;
padding-top:40px;
float: none;
}
<body>
<div id="buttonsmenu">
HOME | LOGIN | REGISTER | ABOUT US | HELP
</div>
<div id="content">
<form action="" method="get">
<input name="search" type="text" id="search" onfocus="clearContents(this);" onchange="RestContents(this);" value="Search Reservation" size="40" /><input type="submit" value="" id="button_style"/>
</form>
</div>
<div id="ad"></div>
</body>
</html>
any suggestions ?
I just think that is padding in your <body> try this
CSS
html, body {padding-bottom:0;}
do that and then if you were sizing you body tag or anything just make sure you don't give it any padding on the bottom.

fix cursor input

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;">

Resources