Solved

html code fit when print

Posted on 2007-12-07
2
2,196 Views
Last Modified: 2010-08-05
if i use  <table width="100%"> it will fit exactly on any paper size. or I need to use with in centiment then it will fit to a4 paper
0
Comment
Question by:teera
2 Comments
 
LVL 16

Accepted Solution

by:
rbudj earned 250 total points
ID: 20427520
It depends on any set width elements you have on your page.  For example, if you have an image with a with a width of 780px then you should be ok, however, it you have an image, or a fixed width <td> larger than 780px then you are taking a chance on having some of it cut off when printing.  I have found that 780px is the maximum fixed width of any element on your page to make your page printer friendly. The best way to test is to open the page in a browser and go to File > print prevew
0
 
LVL 3

Assisted Solution

by:ERNesbitt
ERNesbitt earned 250 total points
ID: 20427571
You could use a style sheet for display and another for printing using the "media" property:

<style type="text/css" media="screen">@import "web.css";</style>
<style type="text/css" media="print">@import "print.css";</style>

Then, set your widths for your table inside the style sheets and give the table an id or a class.

web.css
#content { width:100%; }

print.css
#content { width: 19cm; }

page.html
<table id="content">
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question