Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A non-breaking paragraph for a print CSS?

Status
Not open for further replies.

EdwardMartinIII

Technical User
Sep 17, 2002
1,655
US
I'm building a glossary page, with lots of definitions of words formatted like this:

Banana
A mysterious spider-ridden fruit likely as not to get you high as a kite should you be so foolish as to smoke the dried out skins.

I'm running two different CSS pages -- one for online and one for print.

For the print CSS, I would love to know if there is a way I can keep paragraphs from breaking across a page.

So that way, if the browser's going to break a <p> tag across a page, it'll just push the whole <p> tag over to the next page, instead of putting a hard page break in there and splitting up a definition.

Thoughts? Suggestions? Ideas? Favorite flavor Pop-Tarts?

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Getting high from banana skins? That's a student rumour, just like having a trip by drinking whisky laced with root ginger.

See here:


Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Oh I know allll about banana skins... ;)

Okay, so I'll try this:

Code:
<p class="Unbreakable"><span class="GlossaryWord">word</span><br />Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition</p>

and then in the PRINT stylesheet, I can define

Code:
p.Unbreakable
{
page-break-inside: avoid;
}

testing...

Hm, no cigar.

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
...tried

Code:
<div class="Unbreakable"><p><span class="GlossaryWord">word5</span><br />Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition Definition </p></div>

with

Code:
div.Unbreakable
{
page-break-inside: avoid;
}

Still no luck when I do a "Perview for print".

Am I implementing it wrong?

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Hahaha! "perview". I am soooo tired, my fingers just aren't working right!

Cheers,

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Not an easy solution, huh?

Sorry.

Still can't get it working. I expect my client will kvetch about definitions beraking across pages, but (shrug) I can tell him that there's no way i can control that.

[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top