Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > CSS
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 06-29-2009, 03:46 PM
  #1
shawninder
Novice (Level 1)
 
Join Date: Jun 2009
Posts: 5
iTrader: (0)
shawninder is an unknown quantity at this point
printing cuts image in two

Hello,

I have encoutered an odd problem and have no idea as to what is causing it. But I managed to find two different ways of reproducing the "bug".
Let's start with the basic code:
Code:
<html>
	<head>
		<style type="text/css">
			.graphStats { height: 350px; width: 350px; }
		</style>
	</head>
	<body>
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
	</body>
</html>
I stripped this page down to its minimum for simplicity. When I hit the print preview button, I get a beautiful display of the images one above the other. Having no place at the bottom of page one, the third image is pushed down to page two. Perfect.
Now lets try the same code, with a slight difference (in red)
Code:
<html>
	<head>
		<style type="text/css">
			.graphStats { display: block; height: 350px; width: 350px; }
		</style>
	</head>
	<body>
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
	</body>
</html>
I hit the preview button again (Please try it yourself to see the problem). This time, the third image is cut in two and each half is displayed on a seperate page. This is what I can't get my head around. What is causing the image to break?

Here is another version of the code with another slight difference (in red)
Code:
<html>
	<head>
		<style type="text/css">
			.graphStats { float: right; height: 350px; width: 350px; }
		</style>
	</head>
	<body>
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		a
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
		<img class="graphStats" src="http://mescoupsdecoeur.m.e.pic.centerblog.net/whi17iuw.jpg" alt="Titre" />
	</body>
</html>
you see the red "a"? If I take that out, the third image is pushed down to the second page. If I leave it in, the third image is cut in two. If I take the "a" out and put it after the third or fourth image, no problem, but if I put it after the first or second image, image breaks.

Does anyone have a clue what's happening here?

Thanks in advance

Shawn

Last edited by shawninder : 06-29-2009 at 03:55 PM. Reason: forgot the slash in the closing CODE tag
shawninder is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-02-2009, 01:05 AM
  #2
Sawtooth500
Lord (Level 16)
 
Sawtooth500's Avatar
 
Join Date: Nov 2007
Location: Chicago, IL. USA
Posts: 546
iTrader: (0)
Sawtooth500 is on a distinguished road
I'm uncertain as to what you are trying to accomplish here...

In your base code you say that the images display vertically one above each other. For me, they all display horizontally. If you put display to block then they all display vertically. Also when you say "the third image is cut in two and pushed to the next page" HTML files don't get cut into pages, you just scroll down...

Please clarify what you are trying to accomplish and what you mean by the images are getting cut.
__________________
-Taras Hryniw

http://www.waltonstreetwebdesign.com
Sawtooth500 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-03-2009, 09:34 AM
  #3
shawninder
Novice (Level 1)
 
Join Date: Jun 2009
Posts: 5
iTrader: (0)
shawninder is an unknown quantity at this point
"When I hit print preview"

Let me try to rephrase this.
The problem occurs when I want to print.
I click File -> Print Preview to get a preview of what the printed page will look like, and that is when the scrollable page is cut into multiple pages. The problem is that the third image, instead of appearing on the second page when the first page is full, is cut in two and displayed on two seperate pages (In the print preview screen)

As for my multiple example, they were my attempts at figuring out what exactly the problem is.

So to put it simply
problem: image is cut in two in the print preview window
what I'm trying to accomplish here: Find a solution (idealy css) that will prevent any image from beign cut in the print preview window (nor on the actual paper after print)


Does that clarify a bit?

P.S I subscribed to this thread using Instant email notification, but did not receive any email, what should I do?
shawninder is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-03-2009, 03:22 PM
  #4
Sawtooth500
Lord (Level 16)
 
Sawtooth500's Avatar
 
Join Date: Nov 2007
Location: Chicago, IL. USA
Posts: 546
iTrader: (0)
Sawtooth500 is on a distinguished road
In that case this should help:

http://www.tech-recipes.com/rx/616/h...-a-page-break/
__________________
-Taras Hryniw

http://www.waltonstreetwebdesign.com
Sawtooth500 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-03-2009, 03:54 PM
  #5
shawninder
Novice (Level 1)
 
Join Date: Jun 2009
Posts: 5
iTrader: (0)
shawninder is an unknown quantity at this point
The code I gave you is stripped down to it's bare minimum. My real situation is a huge page full of dynamically-fetched content and the problem images are php-generated graphics. It is very difficult to know when and where to add a page break since more than one of these graphics go on a same page.

Your solution is good and if I find nothing else, I will use it. But it doesn't completely solve my problem. Indeed, if I choose to add a page break before each image, then I will never be able to print two of these images on a same page...
I wonder if there is a way to specify that the page break should only happen if something is about to break. Do you think?
(I already tried auto, the third image still breaks, have a try on my first example with display: block added)

Thanks a lot, I think we're heading in the right direction here.

Shawn
shawninder is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 04:27 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.