SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist FCC's Avatar
    Join Date
    May 2006
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Printing out websites

    Hi All,

    I have been working on a page that allows the printing of job postings. THe problem is the number of job postings on one printed page varies because of the content of each job posting.

    For example, one page perfectly fits 2 job postings, but another page contains 2.5 postings where the 3rd job posting is cut off and the other half is contained on another page.

    So my question is:

    Are there any ways I can use to make it so that either we have the FULL posting on the page, or we just put that job posting on the next page, and leave a huge blank space on the first page.

    THanks

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since that's to do with presentation, you control it with CSS.

    Code:
    .jobPosting {
      page-break-before:always;
    }
    Put that in a CSS file or STYLE element where the media attribute includes print (or all).
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Evangelist FCC's Avatar
    Join Date
    May 2006
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THis is the first time I've ever used the media attribute so I am not very familiar with it. But basically each job posting is put in a table so would I do this?

    Code:
    @media print table.centered-table
    {
    	page-break-before:always;
    }
    Where the table class is centered-table?

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    @media print {
     table.centered-table { page-break-before:always; }
    }
    This is the media at-rule, the attribute Tommy was talking about was <style media="print"> in the markup.
    Simon Pieters

  5. #5
    SitePoint Evangelist FCC's Avatar
    Join Date
    May 2006
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THat certainly helped, but I think there is some misunderstanding here.

    Now the problem is the fact that each page contains exactly one job posting. But the job posting vary in sizes. So sometimes I've left with one page that has a job posting that takes up only like 1/4 of the page.

    Is there a way to make it so that the job postings will fill the page until the last job posting IS CUT OFF and moved to the next page?

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try
    Code:
    .jobPosting {
      page-break-inside:avoid;
    }
    but browser support isn't all that good IIRC.
    Birnam wood is come to Dunsinane

  7. #7
    SitePoint Evangelist FCC's Avatar
    Join Date
    May 2006
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well that helps a bit. I don't have rows being cut in half anymore. But you are right about browser support in the fact that Mr. IE doesn't support it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •