Css style problems on input in IE8 - html

I have a problem getting the text in an input to show correct in Internet Explorer 8.
Firefox, Safari and Chrome all show the same.
Firefox, Safari and Chrome
Internet Explorer 8
<form action="" method="get">
<input id="q" name="q" type="text">
<input id="s" name="s" type="submit" value="Sök">
</form>
#q {
background:url(../../image_layout/search_field.png) no-repeat;
width:209px;
height:32px;
padding:0 5px 0 5px;
text-align:left;
margin:0;
border:0;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#09305b;
font-weight:bold;
position:absolute;
left: 0px;
top: 19px;
}
#s {
background:url(../../image_layout/serach_buttom.png) no-repeat;
width:56px;
height:34px;
padding:0;
margin:0;
color:#FFFFFF;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
border:0;
position:absolute;
left: 225px;
top: 17px;
}

Try specifying a line-height: 34px or thereabouts.

There is a CSS3 rule: the box-sizing. This rule is supported by IE8.
The IEs(including IE8) have non-standard box model, where padding and border are included into width and height whereas other browsers go with standard and don't include padding and border into width . It is described in detail here.
By setting the box-sizing to content-box you tell the browsers not to include border and padding into width, and if you set box-sizing: border-box, all browsers will include border and padding into width. This or this, the display will be consistent across all modern browsers(not that IE8 is so modern, but it supports this rule too :).

I had to set the line-height and display: inline. No idea why, but it worked for me.

Set a line-height property for search input field #q?

Try setting a line-height targeting IE8 and below, like this:
line-height: 32px\9;
line-height value should be equal to input's height and \9 will target IE8 and below.

The position of input should be position:absolute; in order for line-height:37px; and display:inline; to work.

I had much trouble with that, and finally i resolved it:
for ex. you set
INPUT {
line-height: 44px
}
and...
INPUT:focus {
line-height: 45px
}
this one...f... pixel makes the difference (focus shoud have +1px more than normal) and now you have your cursor in good position at IE8.

Just use
line-height: 34px!important;
height: 34px;

I can't comment yet, Matthew's answer worked for me, but in case people wanted an IE-only wrapper without searching anywhere else:
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
line-height: 20px;
}

Related

Firefox issue span with padding and border

So, I have a span with some text in it, it has padding and it has a border.
It displays ok in chrome and safari, but in firefox it has more space between the text and the bottom border than between the text and the top border. Inspecting the element in firefox I figured out that the span in firefox has more height than the text inside it, and the text is top-aligned. Below is a screenshot to explain myself.
But first, this is the code:
span.num{
border:1px solid #00B288;
border-radius: 5px;
padding:5px 15px;
font-size:25px;
color:#fff;
font-weight:100;
letter-spacing: 0.5px;
}
<span class="num">0800-777-8101</span>
Chrome: http://puu.sh/lHWSM/aa4e15a522.png
Firefox: http://puu.sh/lHWUv/aa066712c3.png
As you can see in this last screenshot, firefox is making the span take bigger height than it's content. http://puu.sh/lHX1V/c6f6a12c13.png
How can I fix this?
That is because Chrome and Firefox render fonts differently and also have a different default line-height. Setting a fixed line-height and setting display:inline-block You can force them to render the element with the same rules.
Example:
span.num{
border:1px solid #00B288;
border-radius: 5px;
padding:5px 15px;
font-size:25px;
color:#fff;
font-weight:100;
letter-spacing: 0.5px;
line-height:1.2em;
display:inline-block;
}

Why is the height calculation so inconsistent in Gecko and Blink when dealing with inline-block elements?

As you can see below, both Gecko and Blink performs an inconsistent height calculation for different inline-block elements, even though they all have the same css class. It seems like (*pause*) Trident is the only layout engine to get it right.
Did I forget to (re)set a property?
Furthermore, as you can see in this fiddle, if I change the padding from .3em to 1em Blink renders as expected. All elements gets the same height. Gecko is still "broken" though.
Does anyone know why this is happening and how to fix it?
<a> <button> <input> <span>
Gecko (Firefox v. 39.0)
Blink (Google Chrome v. 43.0.2357.132 m):
Trident (Internet Explorer v. 11.0.9600.17843):
body {
font: normal 15px arial;
padding: 1em;
}
.button {
background: #444444;
border: none;
box-sizing: content-box;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-family: arial;
font-size: 1em;
height: auto;
line-height: normal;
margin: 0;
min-height: 1em;
padding: .3em;
text-decoration: none;
}
<a class="button" href="#">button</a><button class="button">button</button><input class="button" type="button" value="button" /><span class="button">button</span>
For Gecko (Firefox), it is due to borders on ::moz-focus-inner for form elements. If you notice, the form elements (input and button) are always ~2px wider and taller than other elements.
To solve it, always add this to your CSS (as part of your reset):
button::-moz-focus-inner{
border:0;
padding:0;
margin-top:-2px;
margin-bottom:-2px;
}
input::-moz-focus-inner{
border:0;
padding:0;
margin-top:-2px;
margin-bottom:-2px;
}
The negative margins are necessary so that the font displays "correctly" in the line-height. You may need to tweak the values to fit your line-height, but these values mostly work fine.
For Blink (Chrome), the elements are actually the same size, but the only issue is that they are "mis-aligned". You'll notice that sometimes the form elements display slightly lower than the others in an inline-block setting. To solve it, simply ensure that they all use the same vertical alignment, e.g.:
display: inline-block;
vertical-align: top;
It is always a good practice to declare the two properties above together - if you specify inline-block, always remember to specify the vertical alignment, in order to prevent misalignment.

Trying to remove border around PayPal input in Chrome

I'm trying to remove this border around my PayPal input as well as center align the text.
It works fine in Firefox but bugs in Chrome.
Here's a link to what I'm working on.
http://jsfiddle.net/R28f7/1/
I've tried this focus fix, but no luck.
textarea:focus, input:focus{
outline: 0;}
I have been trying to fix this for a while now and any help would be appreciated. Thank you!
Are you able to change the HTML markup of the input type to button ? Doesn't seem like you are using it as an image anyways.
<button type="submit" class="button_fix">Order Now</button>
Since you are trying to align your text to the center, remove the padding from the right and left and apply text-align:center; Here is an updated fiddle:
http://jsfiddle.net/DL6QU/7/
Try to use like this: DEMO
HTML:
<input type="submit" class="button_fix" name="submit" value="Order Now">
CSS:
.button_fix {
display:block;
background-color:#c0392b;
text-align:center;
width:200px;
padding:10px 35px;
color:#fff;
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
-webkit-border-radius: 8px;
/* Firefox 1-3.6 */
-moz-border-radius: 8px;
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
border-radius: 8px;
font-size:2em;
font-weight:200;
font-family: Helvetica, sans-serif;
margin:10px auto 0px auto;
outline:none;
border:0;
}
Hope this helps

CSS: background image for submit button

I have styled submit button with custom background image. But it shows differently on different browsers.
Almost all browsers shows it correct:
But on 2 it have extra height:
Can anyone point what wrong is with my markup?
CSS:
input[type="submit"]{
background: url(http://dl.dropbox.com/u/17055243/icons.png) -99px 0px no-repeat;
width:30px;
height:30px;
border:none;
float:left;
margin:30px 0 0;
cursor:pointer;
}
HTML:
<form>
<input type="text" class="placeholder" value="Search" />
<input type="submit" value="" />
</form>
Tested:
IE 8.0 good
IE 7.0 good
iPhone good
Chrome 24.0 good
Firefox 18.0.2 good
Safari 5.1 (Mac OS X 10.7.1) good
Opera 12.14 (Windows 7 32-bit) good
Safari 5.1.7 (Windows 7 32-bit) extra height
Opera 11.51 (Mac OS X 10.7.1) extra height
Live demo on jsfiddle.
It looks to me the height of the textbox is different not the submit button. Try setting the height of the textbox.
I see in the second search bar, the text is italic and looks slightly smaller. I think the search bar is adjusting to the text and making itself smaller, which makes the search icon appear larger.
What you probably need to do is add this to your stylesheet where the placeholder is controlled:
{font-style:normal}
Try this.
It will give a fix height to the element.
input[type="text"]{
margin:30px 0 0;
width:226px;
color:#999999;
font-size:12px;
font-style:italic;
border:1px solid #cccccc;
border-right:none;
background-color:#ededed;
float:left;
height:28px;
padding-right: 7px;
padding-left: 7px;
line-height: 28px;
}
Submit buttons & input textfields have different default values for borders, margins, padding, etc. First of all you have to put this to both submit buttons and textfields
margin:0;
padding: 0;
border: none;
outline: none;

Why i cant see this image button on IE8 with this CSS?

So, this is the html code for the button
<input type="submit" name="logueo" value="log" id="sendbu"/>
And this is the css style
#sendbu { width: 50px; height: 34px; font-family: Verdana, Geneva, Tahoma, sans-serif; font-size: 12px; background: transparent url(lock.png) no-repeat center top; border: 0; text-indent: -1000em; cursor: pointer; cursor: hand; }
All this works on Chrome and Firefox, but in IE the button seams to dont exist. Thanks for the help.
#domingo why text-indent - 1000em , ie does a different calculation on negative margins , try to remove that and check once
font-size: 0; works sometimes. I'm sure there are sites that use negative indent that work in IE.
Try: background: transparent url(lock.png) center top no-repeat;, and also the 'name' and 'id' properties should match, different flavours of Browser use 'name' differently.