tags:

views:

44

answers:

2

I have four buttons in an HTML form. Here is the HTML:

                <div class="fileinputs">
                    <input type="file" class="file" name="uploadedfile" />
                    <div class="fakefile">
                            <img src="../assets/images/uf_btt.png" />
                    </div>
                </div>
                <div class="fileinputs">
                    <input type="reset" class="file" />
                    <div class="fakefile">
                            <img src="../assets/images/reset_btt.png" />
                    </div>
                </div>
                <div class="fileinputs">
                    <input type="button" class="file" onclick="window.print()" />
                    <div class="fakefile">
                            <img src="../assets/images/print_btt.png" />
                    </div>                      
                </div>

Here is the CSS:

input[type=submit]
{
    width: 119px;
    height: 47px;
}

input[type=button]
{
    width: 119px;
    height: 47px;
}

input[type=reset]
{
    width: 119px;
    height: 47px;
}

input[type=file]
{
    width: 119px;
    height: 47px;
}

div.fileinputs {
    position: relative;
    float: left;
}

div.fakefile {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 1;
}

input.file {
    position: relative;
    text-align: right;
    -moz-opacity:0 ;
    filter:alpha(opacity: 0);
    opacity: 0;
    z-index: 2;
}

All four buttons are displayed properly in all browsers except IE, where they are somewhat mispositioned. It seems to me that IE doesn't know how to put the picture above the 'file' input type, and therefore there is a space to the right of it, which is taken by the transparent "browse" button. If you open the page in IE and try using the buttons, you'll see what I mean: eximi.dreamhosters.com/Hawaii/html/contact_email.php Any insight, please?

Thank you!

A: 

This is a bit of a long shot, but try putting

position: relative;

on the styles for your buttons (i.e. .submit, .print, .reset).

I've worked on issues where this has solved some mysterious CSS problems in IE. I've found a reference that refers to this as the IE magic bullet: http://www.communitymx.com/content/article.cfm?cid=C37E0

Jonathon
Thank you!But it didn't work.Although I changed the HTML - I put the rest three buttons into the same classes as the 'file' button. It's gotten a little better - all four buttons are displayed now in IE, but somewhat mispositioned. It seems to me that IE doesn't know how to put the picture above the 'file' input type, and therefore there is a space to the right of it, which is taken by the transparent "browse" button. If you open the page in IE and try using the buttons, you'll see what I mean:http://eximi.dreamhosters.com/Hawaii/html/contact_email.php
vlevsha
+1  A: 

IE doesn't understand css selectors like [type=button].

Uses classes instead.

I know, it's unfortunate, and annoying.. it's IE.

Ben
Honestly, if all the buttons are the same, then the selectors are redundant anyways. Simply doing a single input {...} will be sufficient and less overhead to boot.
bpeterson76
Dear Ben, thank you so much!It worked!Dear bpeterson, that's exactly what I do (I guess) - I use the same set of classes for all the buttons.Thank you!
vlevsha