Solved

html code fit when print

Posted on 2007-12-07
2
2,199 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Text color and background in a text box. 2 36
HTML question 2 33
Why is my $_POST not going to results page 10 68
carousel control extend past the images 9 25
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

732 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