开发者

css IE and firefox problem

开发者 https://www.devze.com 2023-02-20 16:00 出处:网络
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?

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


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


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.


Put this at the top of the page:

<!DOCTYPE html>


  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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消