Asim Zaidi
Asim Zaidi

Reputation: 28294

css IE and firefox problem

I have a button which I want at a certain poistion on the screen. Problem is in firefox its a little up and in IE its a little down. What can I do?

.btn1{
    clear: both;
    margin-top: 4%;
    margin-bottom: 0px;
    margin-right: 0px;
    margin-left: 740px;
}

Upvotes: 0

Views: 231

Answers (5)

Chugworth
Chugworth

Reputation: 490

You need to use a "CSS reset"... Google for it :-) Every Browser has his own default CSS, thats the problem ;-)

Upvotes: 0

Robik
Robik

Reputation: 6127

  1. Have you in your HTML code this? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  2. Use specified stylesheets:

    <!--[if IE]> <link rel="stylesheet" href="ie.css" /> <![endif]-->

  3. Do you know that you can use: margin: 4% 0px 0px 760px;?

  4. If you want to make something horizontally-center use: margin: 0px auto;. Cause 760px may crash in lower/higher resolutions.

Upvotes: 0

ray
ray

Reputation: 8699

Put this at the top of the page:

<!DOCTYPE html>

Upvotes: 0

Mark
Mark

Reputation: 5720

The reason you are seeing differences between browsers is because you are using %. % is calculated and rounded differently between different browsers. Try using px or pt

Upvotes: 1

Remixz
Remixz

Reputation: 139

Do a normal stylesheet that makes it work on just Firefox. Then, do this:

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="your-stylesheet-here.css" />
<![endif]-->

Make this stylesheet a specific one for IE, so that the box looks correct on IE.

Upvotes: 0

Related Questions