Margins and Padding for Forms Not Responding in IE8 - css

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

Related

Textbox doesn't fit into division

Recently I try to fit textbox for publishing post. Main problem - textbox doesn't want to fit properly, even if it obviously should. Here is the image:
and here is the JSFiddle file I prepared for this question:
https://jsfiddle.net/Ch3shireDev/u0j5rgud/4/
It looks like a textbox is naturally expanded to the right.
body {
margin: 0;
height: 100%;
width: 100%;
}
.post {
display: flex;
background-color: lightgrey;
border-radius: 10px;
/* width: auto; */
height: 300px;
padding: 5px 5% 5px 5%;
margin: 20px;
box-shadow: #888888 1px 1px 1px 1px;
}
.background {
margin: 5px;
border: 1px solid;
padding: 0;
}
textarea {
resize: none;
width: 80%;
margin: 10px;
}
.titlebox {
height: 20px;
}
.message {
height: 100px;
}
.background {
width: 100%;
padding: 10px;
}
textarea {
margin: 0;
height: auto;
width: 100%;
}
.input {
background-color: red;
padding: 5px;
}
.buttons {
float: right;
padding-top: 5px;
padding-left: 5px;
margin-bottom: 0;
margin-right: 0;
padding-right: 0;
}
<div class=post>
<div class=background>
<div class=title>
<h3>
Publish post
</h3>
</div>
<div class=input>
<form>
<textarea class=message cols=50></textarea>
</form>
</div>
<div class=buttons>
<input type="submit" value="Preview" />
<input type="submit" value="Send" />
</div>
</div>
</div>
What should I do to get textbox fitting right?
For your textarea, just add box-sizing: border-box;.
textarea{
resize:none;
width:80%;
margin: 10px;
box-sizing: border-box;
}
https://jsfiddle.net/u0j5rgud/6/
border-box: The width and height properties (and min/max properties) includes content, padding and border
You have 2 textarea rules in your css, try deleting the one with the wodth set to 100%
Remove the padding from your textarea
textarea {
padding: 0;
}

Scrolling on overflow when making a list of N items

I have a prompt-box div that has a max-height of 80% of the screen.
Inside of it, I have a ul which holds a bunch of li elements depending on how many the user adds.
How do I configure this so that once that prompt-box hits a certain size, new items can be added to the list but the contents just scroll instead of overflowing like this?
Thanks!
Edit: Adding html & css
<div className='prompt-box'>
<p className='title'>What's in your future?</p>
<ul className='options-holder'>
{
this.state.items.map(item => (
<li key={item.id} className='option'>
<div className='circle' />
<p className='item-text'>{ item.text }</p>
</li>
))
}
<li key={0} className='option form'>
<div className='circle' />
<form className='new-item-form' onSubmit={this.handleSubmit}>
<input className='new-item-input' placeholder='Type something and press return...' onChange={this.handleChange} value={this.state.text} />
</form>
</li>
</ul>
<button className='confirm-button'>Continue</button>
</div>
.prompt-box {
#include absolute-center;
background: #1E1E1E;
width: 35%;
margin: 0 auto;
border-radius: 7px;
border: 1px solid rgba(255, 255, 255, 0.1);
color: #ccc;
font-family: 'Circular Book';
max-height: 80%;
overflow-y: auto;
}
.prompt-box .title {
text-align: center;
font-size: 30px;
margin-top: 30px;
margin-bottom: 25px;
}
.prompt-box .options-holder {
list-style: none;
border-radius: 3px; // not currently working
padding: 0;
width: 95%;
margin: 12px auto;
}
.prompt-box .option {
background: #303030;
padding: 18px;
border-bottom: 1px solid rgba(196, 196, 196, 0.1);
}
.prompt-box .option.form {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.prompt-box .item-text {
color: white;
font-size: 24px;
margin: 0;
display: inline-block;
padding: 0 18px;
}
.prompt-box .new-item-form .new-item-input {
background: transparent;
border-style: none;
font-size: 24px;
padding-left: 18px;
color: white;
width: 80%;
&:focus { outline: none; }
}
.prompt-box .confirm-button {
width: 95%;
margin: 22px auto 18px auto;
}
You haven't shown us any HTML/CSS code for us to reproduce and test a fix for the issue, but adding something like this should work, to allow that container to scroll vertically when its height is exceeded:
.prompt-box {
overflow-y: auto;
}
Try a overflow: scroll; style rule on your div.prompt-box. (You're already giving it a max height, so the extra contents should have a vertical scroll bar).
I threw a max-height and an overflow-y: scroll on the ul and it did the trick.

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>

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

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