?
Solved

html code fit when print

Posted on 2007-12-07
2
Medium Priority
?
2,208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
rbudj earned 1000 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
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…
Suggested Courses

800 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