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>
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">
Use specified stylesheets:
<!--[if IE]> <link rel="stylesheet" href="ie.css" /> <![endif]-->
Do you know that you can use:
margin: 4% 0px 0px 760px;
?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 ;-)
精彩评论