Printing a page with no links printed

Discussion in 'HTML' started by Ed Jay, Nov 5, 2005.

  1. Ed Jay

    Ed Jay Guest

    I recall seeing where using CSS one can print a browser page without
    printing the links. How is it done?

    --
    Ed Jay (remove M to respond by email)
    Ed Jay, Nov 5, 2005
    #1
    1. Advertising

  2. "Ed Jay" <> skrev i meddelandet
    news:...
    > I recall seeing where using CSS one can print a browser page without
    > printing the links. How is it done?
    >
    > --
    > Ed Jay (remove M to respond by email)




    You create a relative style sheet for print and you put

    a <div menu> container</div> on it
    which contains the links
    and use display:none;
    as property.
    You use the same class in your menu
    in the body or in

    <?php include "menu.html"; ?>
    where menu is the file name which you may have used to display the list of
    links.


    --

    Luigi Donatello Asero
    https://www.scaiecat-spa-gigi.com
    Luigi Donatello Asero, Nov 5, 2005
    #2
    1. Advertising

  3. "Luigi Donatello Asero" <> skrev i meddelandet
    news:WvVaf.149970$...
    >
    > "Ed Jay" <> skrev i meddelandet
    > news:...
    > > I recall seeing where using CSS one can print a browser page without
    > > printing the links. How is it done?
    > >
    > > --
    > > Ed Jay (remove M to respond by email)

    >
    >
    >
    > You create a relative style sheet for print and you put
    >
    > a <div menu> container</div> on it
    > which contains the links
    > and use display:none;
    > as property.
    > You use the same class in your menu
    > in the body or in
    >
    > <?php include "menu.html"; ?>
    > where menu is the file name which you may have used to display the list of
    > links.


    This way the links are not displayed when you print but they may be
    displayed on the computer screen
    if your standard style sheet uses another value for the property display.

    --
    Luigi Donatello Asero
    https://www.scaiecat-spa-gigi.com/sv/boende-i-italien.php
    Luigi Donatello Asero, Nov 5, 2005
    #3
  4. Ed Jay

    brucie Guest

    In post <news:>,
    Ed Jay said:

    > I recall seeing where using CSS one can print a browser page without
    > printing the links. How is it done?


    using print specific css eg:

    css just for the screen:
    <link rel="stylesheet" href="x.css" type="text/css" media="screen">

    css just for the printer:
    <link rel="stylesheet" href="y.css" type="text/css" media="print">

    or css for the screen and printer:
    <link rel="stylesheet" href="z.css" type="text/css" media="screen,print">

    or using @media rules within css. e.g display blue on red links on screen
    but not to display them when printed:

    /* normal css for links */
    a{background:red;color:blue;}

    /* print specific css for links */
    @media print{
    a{display:none;}
    }

    supply a link to a "print version" of your page or warn the visitor that
    what they see may not be what is printed. its really annoying when you
    expect one thing to be printed but get something else.


    --
    l i t t l e v o i c e s
    brucie, Nov 5, 2005
    #4
  5. brucie <> wrote:

    >> I recall seeing where using CSS one can print a browser page without
    >> printing the links. How is it done?


    I'm not sure we know what the question is really about. Dropping all links
    sounds strange. Maybe the idea is to print link texts as normal text? That
    would be a different issue. Or maybe the OP has a "navigational menu" that
    he wants to omit from printed copies. That's quite sensible (assuming you
    have such a menu in the first place), but it may involve more that just
    omitting links, depending on they menu has been written.

    > /* normal css for links */
    > a{background:red;color:blue;}


    There's nothing normal about that. It's an example, yes - but a bad one.

    > /* print specific css for links */
    > @media print{
    > a{display:none;}
    > }


    That would do too much, even assuming that the OP really wants to remove all
    links (with their link texts or images). It would also remove any
    <a name="...">...</a> element.

    Better:

    @media print{
    :link, :visited {display:none;}
    }


    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Nov 5, 2005
    #5
  6. Ed Jay

    Jim Higson Guest

    Jim Higson, Nov 5, 2005
    #6
  7. Ed Jay

    Ed Jay Guest

    Ed Jay, Nov 5, 2005
    #7
  8. Ed Jay

    Ed Jay Guest

    "Jukka K. Korpela" <> wrote:

    >brucie <> wrote:
    >
    >>> I recall seeing where using CSS one can print a browser page without
    >>> printing the links. How is it done?

    >
    >I'm not sure we know what the question is really about. Dropping all links
    >sounds strange. Maybe the idea is to print link texts as normal text? That
    >would be a different issue. Or maybe the OP has a "navigational menu" that
    >he wants to omit from printed copies. That's quite sensible (assuming you
    >have such a menu in the first place), but it may involve more that just
    >omitting links, depending on they menu has been written.
    >
    >> /* normal css for links */
    >> a{background:red;color:blue;}

    >
    >There's nothing normal about that. It's an example, yes - but a bad one.
    >
    >> /* print specific css for links */
    >> @media print{
    >> a{display:none;}
    >> }

    >
    >That would do too much, even assuming that the OP really wants to remove all
    >links (with their link texts or images). It would also remove any
    ><a name="...">...</a> element.
    >
    >Better:
    >
    >@media print{
    >:link, :visited {display:none;}
    >}

    Thanks much. To answer your concern, my purpose is to print out a results
    report without showing the menu.

    --
    Ed Jay (remove M to respond by email)
    Ed Jay, Nov 5, 2005
    #8
  9. Ed Jay

    brucie Guest

    In post <news:Xns9705B00873FBDjkorpelacstutfi@193.229.0.31>,
    Jukka K. Korpela said:

    >> /* normal css for links */
    >> a{background:red;color:blue;}


    > There's nothing normal about that.


    i missed you too jukka

    > It's an example, yes - but a bad one.


    i like blue on red <a>s, especially if i have a hangover

    --
    l i t t l e v o i c e s
    brucie, Nov 5, 2005
    #9
  10. Ed Jay <> wrote:

    > my purpose is to print out a results
    > report without showing the menu.


    Then the simplest approach is to define a class for the element containing
    the menu (<div>, <ul>, whatever), say <div class="navi">, and use a class
    selector in CSS:

    @media print { .navi { display: none; } }

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Nov 5, 2005
    #10
  11. Ed Jay

    Ed Jay Guest

    "Jukka K. Korpela" <> wrote:

    >Ed Jay <> wrote:
    >
    >> my purpose is to print out a results
    >> report without showing the menu.

    >
    >Then the simplest approach is to define a class for the element containing
    >the menu (<div>, <ul>, whatever), say <div class="navi">, and use a class
    >selector in CSS:
    >
    >@media print { .navi { display: none; } }


    Makes it simple. Thanks again.

    --
    Ed Jay (remove M to respond by email)
    Ed Jay, Nov 5, 2005
    #11
  12. "Ed Jay" <> skrev i meddelandet
    news:...
    > Jim Higson <> wrote:
    >
    > >Ed Jay wrote:
    > >
    > >> I recall seeing where using CSS one can print a browser page without
    > >> printing the links. How is it done?

    > >
    > >Sounds like a couple of pages on ALA a while back:
    > >
    > >http://www.alistapart.com/articles/goingtoprint/
    > >and
    > >http://www.alistapart.com/articles/improvingprint
    > >

    > Yes, thank you.
    >
    > Thanks also to Luigi, Jukka and brucie for your valuable inputs.



    You are welcome
    --
    Luigi Donatello Asero
    https://www.scaiecat-spa-gigi.com
    Luigi Donatello Asero, Nov 5, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2FtZWVy?=

    printing to pre-printed page.

    =?Utf-8?B?c2FtZWVy?=, Jun 2, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    410
    =?Utf-8?B?c2FtZWVy?=
    Jun 2, 2005
  2. =?Utf-8?B?c2FtZWVy?=

    printing to pre-printed page.

    =?Utf-8?B?c2FtZWVy?=, Jun 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    396
    Oenone
    Jun 8, 2005
  3. =?Utf-8?B?R3VoYW5hdGg=?=

    Set value from web page to pre printed form

    =?Utf-8?B?R3VoYW5hdGg=?=, Oct 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    376
    S. Justin Gengo
    Oct 1, 2005
  4. Richard Lewis
    Replies:
    0
    Views:
    301
    Richard Lewis
    Aug 27, 2003
  5. Abby Lee
    Replies:
    2
    Views:
    330
    brucie
    Oct 14, 2004
Loading...

Share This Page