javascript - print webpage in two columns - Stack Overflow

How to print a webpage in two columns or one column as per the user inputchoice.And when a take a prin

How to print a webpage in two columns or one column as per the user input/choice.

And when a take a print out I'm getting the website url on the top left side, How can we stop printing this?

Regards

How to print a webpage in two columns or one column as per the user input/choice.

And when a take a print out I'm getting the website url on the top left side, How can we stop printing this?

Regards

Share Improve this question asked May 10, 2010 at 19:18 user237865user237865 1,2504 gold badges19 silver badges41 bronze badges 1
  • 1 Could you be a little bit more specific? I'm afraid I don't understand your question fully. – Harmen Commented May 10, 2010 at 19:27
Add a ment  | 

5 Answers 5

Reset to default 2

When specifying a <link> (such as to a CSS stylesheet) you can specify a media attribute so the CSS will only be used for print or screen. (or braille!) The CSS in this file can then re-style your site into columns as you see fit.

<link type="text/css" rel="stylesheet" href="print.css" />

You could specify two print CSS files like this, and - using JavaScript - prompt the user for which CSS file to use when they print, toggling the disabled member of the <link>:

var printCSS = document.getElementsByTagName("link")[n];
printCSS.disabled = true;
printCSS.disabled = false;

With mozilla, you can use the -moz-column-count style:

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3/TR/html4/loose.dtd'>
<html>
<head>
  <title>Two columns</title>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>
<body>

  <div style='-moz-column-count:2'>
     one<p>
     two<p>
     three<p>
     four<p>
     five<p>
     six
  </div>

</body>
</html>

It doesn't work with IE, however, and I don't think there's something equivalent for IE, either.

As for the printing of the URL, others have already pointed out that you have no control over it. The user can (and I usually do) in Firefox in the dialog File -> Page Setup -> Margins & Header/Footer: set Header and footers to blank.

You can add a style-sheet specific for printing and in theory that would allow you to print your content in 2 columns or 1, depending on user choice and how well your html is organized.

The address at the top of the print-out es from the visitor's browser and I doubt you can turn it off at it is a setting that only the visitor has control over.

The URL appearing on the page is a browser setting and cannot be controlled by script.

Two print in two columns, make sure your HTML uses a print stylesheet and make sure your HTML can easily be reformatted in two columns using floats.

How to print a webpage in two columns or one column as per the user input/choice.

You could provide an alternative stylesheet using @media rule to provide a different layout that is only applied to print media … but I suspect this is better off left to the user's printer settings.

And when a take a print out I'm getting the website url on the top left side, How can we stop printing this?

This is a browser preference. Authors can't remove it.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744957878a4603304.html

相关推荐

  • javascript - print webpage in two columns - Stack Overflow

    How to print a webpage in two columns or one column as per the user inputchoice.And when a take a prin

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信