开发者

Is it Possible to change the Default Margins of Browser through JavaScript?

I want to change the default margins of Browser through JavaScript because I want to print the displayed document on page but the margins are different on different browser??? plz help me to change default margins of browser. if you have a开发者_如何学Cny solution tell me.


Not javascript, but if you are looking for specific styles to use for printing you can use:
<link rel="stylesheet" type="text/css" href="print.css" media="print" />

where print.css would contain something like

* { margin:0 }


I would recommend adding reset.css to your page, and probably to all of your pages/projects.
This way you should be able to eliminate all differencies in default style values amongst browsers.


CSS:

body, html { margin:0 }

or

* { margin:0 }

or look into CSS reset. Would recommend this over JavaScript.


use jquery

$(document).ready(function() {
       $("body").css("margin","0");
});

Using CSS

body { margin:0; }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜