layout difference between IE8 and IE9 - html

I have a site (www.jamesalder.co.uk) which is not rendering properly in IE8 and below.
Here it is in IE8:
And in IE9 and everything else:
As you can see, the search box has moved from top right to the wrong place.
The html for the search box is:
<div id="header">
<img src="/media/header_images/ts-hutton_2.jpg" title="Victorian Paintings at James Alder Fine Art" alt="Victorian Paintings at James Alder Fine Art" "="">
<form id="search-form" action="/search">
<label id="search-label">Search the Site</label>
<input type="image" src="/static/images/sign-up.gif" value="search" id="search-button">
<input type="text" name="q" id="search-input">
</form>
</div>
It seems as though it is totally missing out the following CSS, in that if I disable this CSS, it has the same effect:
#search-form {
position: absolute;
right: 0;
top: 0;
background-color: rgba(255, 255, 255, 0.6);
padding: 3px;
}
Does IE9 have some kind of problem with CSS on forms? Should I put it in a div?
As for the images below that which have decided not to float any more, I have no idea.
Are there any best practices or good resources about getting sites to behave across older versions of IE, or should I just use conditionals?

It was actually caused by malformed html. I had tags which looked like this:
<img src="/media/homepage_images/all-paintings-sale.jpg"
alt="All Victorian Paintings for Sale"
title="All Victorian Paintings for Sale" ">
Notice the " at the end, which was causing everything following it to be treated as text.
Bizarrely, IE9 and everything else fixed the error automatically but IE8 and below didn't.

It may cause by <form>.
Put your <form id="search-form" action="/search"> element in a div.
<div id="header">
<img src="..."/>
<div id="search-form">
<form action="/search"></form>
</div>
</div>
Try this please.

Related

textarea placeholder color not changing in firefox

i have this form:
:-moz-placeholder {
/* Firefox 18- */
color: white;
}
<form id="myForm" action="#" method="post">
<div class="container">
<div class="row">
<div class="col-md-6 padding-2">
<textarea class=" form-control textArea" rows="7" placeholder="Comments/Requests" name="textarea" id="textarea" required="required"></textarea>
</div>
</div>
</div>
placeholder not changing in textarea i tried this css tricks:
the body have a blue background color and the placeholder should be white, it is showing gray...any help? i am new to web development... thanks in advance
From the documentation:
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
and
Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
and
Note: Firefox 51 replaced this feature with the standard :placeholder-shown pseudo-class.

Space appears above form (in Chrome only)

I've got a form, which has a legend and a set of fields. I'm using Bootstrap 2.x to style it. For some reason, space appears above the form, but in Chrome only (it renders fine in IE10 and Firefox). I've pared it back to just the basics to demonstrate the issue I'm having:
<form>
<fieldset>
<legend>Legend</legend>
<div class="control-group">
<!-- This div results in the space appearing above the form -->
<label class="control-label">First Name</label>
<div class="controls">
<input type="text" />
</div>
</div>
</fieldset>
</form>
If I remove the class="control-group" from the div wrapping the input field, the space magically disappears, despite seemingly having nothing to do with this issue. I've checked all the margins and padding of everything in Chrome, and there's nothing, so I don't know where this spacing is coming from. I need to use this class on these field divs, as I'm implementing a horizontal form. I'm pulling my hair out trying to work out how to fix this issue - any ideas? Here's a jsfiddle to demonstrate: http://jsfiddle.net/christhecoder/kDrVH/3/
Any help would be much appreciated!
http://jsfiddle.net/kDrVH/10/
#import url("http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap.min.css");
legend+.control-group{
margin-top:0px;
}
you get 20 margin from this: legend+.control-group
This is because bootstrap CSS rules for <legend> has margin-bottom:20px
Just add a CSS rule:
legend {
margin-bottom: 0px;
}
Also you can add this only to your legend label:
<legend style="margin-bottom: 0px;">
// Whatever you want
</legend>
JSFIDDLE DEMO
Instead of
legend+.control-group {
margin-top: 20px;
}
Use this.
It will preserve your current layout and remove space above the form.
legend+.control-group {
padding-top: 20px;
}

IE8 displaying wrong piece of CSS sprite

There are a million issues with sprites and IE8 i've read about online, however, they all seem to deal with the issue of the sprites not showing up at all. Mine is showing up, its just showing the wrong piece of the sprite. It works fine in all other browsers.
Heres the CSS
div.searchForm input[type=text] {
border: 0;
padding: 0 10px;
margin: 0;
background: url(../img/sprite.png) 0 -125px no-repeat;
background-size: 115% 235px;
width: 600px;
height: 30px;
float: left;
font-size: 12px;
color: #fff;
-webkit-appearance: none;
-webkit-border-radius: 0;
}
and the html:
<section id="secondary6">
<h1 class="hidden">Search</h1>
<div class="clearfix">
<div class="grid_4">
<nav class="grid_2 secondary">
<h1 class="hidden">Search Secondary Navigation</h1>
</nav>
<div class="searchForm">
<input type="text" placeholder="search">
<input type="button">
<input type="submit" class="hidden" >
</div>
</div>
</div>
</section>
basically you click the search button, and it displays a search bar that should be hidden otherwise. Like I said it works in other browsers.
IE8 doesn't support background-size (see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size#Browser_compatibility), so that's what you'll have to work around. Depending on your needs, you might try IE7.js (which works with other versions of IE) or a conditional comment to adjust the position of the image for IE8. Or, just make sure your raw image doesn't need to be re-sized.
What happens when You assign class or ID to particular text input field?
for example..
div.searchForm input.classInput {
/* css code here */
}
Also ...
..where is element form tag wrapper, form name, form action ?
The input fields should not reside in a document on a way You presented.. without form tag..
Which software actually generated this code for You?
Is it dreamweaver?
Basic and proper example of valid HTML input form ..
<form id="formID" name="formName" method="post" action="#">
<input type="text" name="textUno" value="" />
<input type="text" name="textDue" value="" />
<button type="submit" name="do_processing"> Go! </button>
</form>

HTML: Why i can't see elements with html legend tag in browser for mobiles?

The first image belongs to Chrome desktop and the second is a browser for Android, the question is because in the mobile browser (including Safari for iPhone) I can not display the legend label on the site I'm creating, the words "Area de administradores "is a legend that giving slideDown click perform as shown in the image of the desktop browser but in the nevegador for mobiles I can not click.
Know why this error occurs? The next code belongs to the form login:
<div id="content">
<div id="wrapper">
<legend id="leyendaAdmin">// Área de administradores</legend>
<div class="loginIndex" >
<div class="titleIndex">
<img src="images/itcxx.png">
<h1>Bienvenido al<br>Centro de Información</h1>
</div>
<div class="inputLogin">
<form id="formLogin" name="formLogin" method="post" action="doLogin.php">
<center><h2>Iniciar sesión</h2></center>
<p class="fUser">
<input id="ncontrolLogin" name="ncontrolLogin" placeholder="Número de control" type="text" AUTOCOMPLETE=OFF maxlength="8" onKeyPress="return _onlyNumber(event);"/>
</p>
<p class="fPasswd">
<input id="passwdLogin" name="passwdLogin" placeholder="Contraseña" type="password" AUTOCOMPLETE=OFF maxlength="4" onKeyPress="return _onlyNumber(event);"/>
</p>
<input id="bIniciar" name="bIniciar" value="Iniciar" type="submit"/>
</form>
<br/>
<div id="status_msg"></div>
</div>
</div>
</div>
<br/>
<div id="wrapper">
<legend id="leyenda">// Área de visitantes</legend>
<button id="bSearch" name="bSearch">Realizar búsqueda</button>
</div>
</div>
And CSS:
#wrapper legend{
text-align:left;
background-color:#000;
color:#F0F0F0;
font-size:25px;
float:left;
width:100%;
padding:5px 0px 5px 10px;
margin:10px 0px;
border-bottom:1px solid #fff;
border-top:1px solid #d9d9d9;
}
There are at least two problems I can see. One was mentioned in the comments, you cannot have two elements with the same id attribute on one page.
The other issue may be your problem: you are using <legend> incorrectly.
http://www.w3.org/TR/2011/WD-html5-20110525/forms.html#the-legend-element
The legend element
Contexts in which this element can be used: As the first child of a fieldset element.
That means that the only time you can use a <legend> is like this:
<fieldset>
<legend></legend>
<!-- content -->
</fieldset>
Browsers are free to do what they with invalid markup, you may be seeing a side effect of this.
Before trying to solve problems in HTML, CSS, or JavaScript, always check your results with the The W3C Markup Validation Service first. Debugging broken or invalid HTML is impossible.

Image tags in labels with "for" don't respond to clicks in IE7

In a simple setup with an image inside a label:
<input type='checkbox' id='x'>
<label for='x'>click me <img src='http://placedog.com/20/20'></label>
clicks on the image control the checkbox just like clicks on the text in the label or clicks on the checkbox itself, in most browsers. That it doesn't work in IE7 doesn't particularly surprise me, but I'm wondering whether there's some weird IE way of making it work, in that browser.
fake edit hmm apparently it doesn't work in IE8 either.
As discussed in the comments, IE doesn't like this idea. The only way to get around it is with a bit of Javascript - here's an example using JQuery.
$("label img").live("click", function() {
$("#" + $(this).parents("label").attr("for")).click();
});
See http://snook.ca/archives/javascript/using_images_as for a discussion on this.
A little rough and ready, but works without JQuery...
<p>
<input type="radio" id="rb1" value="rb1" />
<label for="rb1">
<img src="image1.png"
onclick="try{document.getElementById('rb1').checked=true;}catch(e){};return true;" />
</label>
</p>
<p>
<input type="radio" id="rb2" value="rb2" />
<label for="rb2">
<img src="image2.png"
onclick="try{document.getElementById('rb2').checked=true;}catch(e){};return true;" />
</label>
</p>
Could be improved, but is fairly resilient as a workaround.
Alternatively you could put an absolutely positioned div spanning the whole width and height of the label. Note though that you have to use IE's opacity filter to make the cover div invisible, because with visibility: hidden it is completely ignored by IE7 and 8.
<style>
.cover{
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background: yellow;
filter: alpha(opacity=0);
opacity: 0;
}
</style>
<label>
<div class="cover"></div>
<img src="img.png" alt="img" />
</label>