inline style with @media=print

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • geotso

    inline style with @media=print

    Hi

    I'm trying to hide from printing a specific element of a page but I don't
    know how (and if) I could. Here is an example of what I'm trying to do:

    [The text here must be visible in print mode]
    <h1>Hidden in print mode</h1>
    <p>Also hidden in print mode</p>
    [Following text visible too]

    Is there a way to hide these two paragraphs with an inline style?
    (I don't know if "inline" is the correct word, so what I'm trying to say is
    something like: <h1 style="@media=p rint(display:no ne)">)

    Thanks

    _______________ _____
    Merlin dying, to the Lady of the Lake:
    "we lived our lives with passion and devotion"

    -=- geotso -=-
    (remove the TRAP to contact me)
  • Peter Foti

    #2
    Re: inline style with @media=print

    "geotso" <geotsoTRAP@hot mail.com> wrote in message
    news:bss7cv$gmr $1@usenet.otene t.gr...[color=blue]
    > Hi
    >
    > I'm trying to hide from printing a specific element of a page but I don't
    > know how (and if) I could. Here is an example of what I'm trying to do:
    >
    > [The text here must be visible in print mode]
    > <h1>Hidden in print mode</h1>
    > <p>Also hidden in print mode</p>
    > [Following text visible too]
    >
    > Is there a way to hide these two paragraphs with an inline style?
    > (I don't know if "inline" is the correct word, so what I'm trying to say[/color]
    is[color=blue]
    > something like: <h1 style="@media=p rint(display:no ne)">)[/color]

    Why would you want to use inline styles? They're evil. :) Seriously,
    though, it defeats the purpose of seperating presentation from content. You
    can do it if you don't use inline styles, but I don't know how you'd do it
    with inline styles.

    Regards,
    Peter Foti


    Comment

    • Neal

      #3
      Re: inline style with @media=print


      "geotso" <geotsoTRAP@hot mail.com> wrote in message
      news:bss7cv$gmr $1@usenet.otene t.gr...[color=blue]
      > Is there a way to hide these two paragraphs with an inline style?[/color]

      In the latest XHTML definition (1.1? off the top of my head) the style
      attribute is deprecated in all tags. So it's not a bad idea to stop using
      any inline styles. Add a class and define it either in the external CSS or
      between the <style> tags in your header.


      Comment

      • Spartanicus

        #4
        Re: inline style with @media=print

        Neal wrote:
        [color=blue]
        >In the latest XHTML definition (1.1? off the top of my head) the style
        >attribute is deprecated in all tags.[/color]

        Not in 1.1 it isn't.

        --
        Spartanicus

        Comment

        • Neal

          #5
          Re: inline style with @media=print


          "Spartanicu s" <me@privacy.net > wrote in message
          news:8co3vvk1to 2pcvnt2ukf6kar4 fo1of5fsq@news. spartanicus.utv internet.ie...[color=blue]
          > Neal wrote:
          >[color=green]
          > >In the latest XHTML definition (1.1? off the top of my head) the style
          > >attribute is deprecated in all tags.[/color]
          >
          > Not in 1.1 it isn't.
          >
          > --
          > Spartanicus[/color]



          Unless I'm screwed up... which IS possible...


          Comment

          • Spartanicus

            #6
            Re: inline style with @media=print

            Neal wrote:
            [color=blue][color=green][color=darkred]
            >> >In the latest XHTML definition (1.1? off the top of my head) the style
            >> >attribute is deprecated in all tags.[/color]
            >>
            >> Not in 1.1 it isn't.[/color]
            >
            >http://www.w3.org/TR/xhtml11/doctype.html
            >
            >Unless I'm screwed up... which IS possible...[/color]

            I'm not sure what that refers to, usage of the style attribute is valid
            in xhtml 1.1, given that there is no transitional doctype with 1.1,
            afaik that implies that it isn't deprecated

            --
            Spartanicus

            Comment

            • Anne van Kesteren

              #7
              Re: inline style with @media=print

              Spartanicus wrote:
              [color=blue]
              > Neal wrote:
              >
              >[color=green][color=darkred]
              >>>>In the latest XHTML definition (1.1? off the top of my head) the style
              >>>>attribute is deprecated in all tags.
              >>>
              >>>Not in 1.1 it isn't.[/color]
              >>
              >>http://www.w3.org/TR/xhtml11/doctype.html
              >>
              >>Unless I'm screwed up... which IS possible...[/color]
              >
              >
              > I'm not sure what that refers to, usage of the style attribute is valid
              > in xhtml 1.1, given that there is no transitional doctype with 1.1,
              > afaik that implies that it isn't deprecated
              >[/color]

              Indeed, it isn't even deprecated in XHTML2.0 (whenever that comes out),
              though the fact that it is still valid, doesn't mean you should use it.

              --
              Anne van Kesteren
              <http://www.annevankest eren.nl/>

              Comment

              • news individual

                #8
                Re: inline style with @media=print

                "geotso" <geotsoTRAP@hot mail.com> wrote in message
                news:bss7cv$gmr $1@usenet.otene t.gr...[color=blue]
                > Hi
                >
                > I'm trying to hide from printing a specific element of a page but I don't
                > know how (and if) I could. Here is an example of what I'm trying to do:
                >
                > [The text here must be visible in print mode]
                > <h1>Hidden in print mode</h1>
                > <p>Also hidden in print mode</p>
                > [Following text visible too]
                >[/color]


                @media print{
                {
                h1:display:none ;
                }
                {p:display:none ;
                }
                }

                This will hide every h1 and p element from printing. If you need to only
                hide one specific h1 element and one specific p element, then you will have
                to give them a class (to differentiate them from other h1 and p tags on the
                page) and then adjust the css in your @media:print rule accordingly.

                Have a look at www.webmasterworld.com/forum83 where this had been discussed
                in the last month or so.
                Jools


                Comment

                • Lauri Raittila

                  #9
                  Re: inline style with @media=print

                  In article news individual wrote:[color=blue]
                  > "geotso" <geotsoTRAP@hot mail.com> wrote in message
                  > news:bss7cv$gmr $1@usenet.otene t.gr...[color=green]
                  > > Hi
                  > >
                  > > I'm trying to hide from printing a specific element of a page but I don't
                  > > know how (and if) I could. Here is an example of what I'm trying to do:
                  > >
                  > > [The text here must be visible in print mode]
                  > > <h1>Hidden in print mode</h1>
                  > > <p>Also hidden in print mode</p>
                  > > [Following text visible too]
                  > >[/color]
                  >
                  >
                  > @media print{
                  > {
                  > h1:display:none ;
                  > }
                  > {p:display:none ;
                  > }
                  > }
                  >
                  > This will hide every h1 and p element from printing.[/color]

                  Well, if it does, that means that you have incorrectly working browser.

                  Correct syntax:

                  @media print {
                  h1,p {display:none;}
                  }
                  [color=blue]
                  > If you need to only
                  > hide one specific h1 element and one specific p element, then you will have
                  > to give them a class (to differentiate them from other h1 and p tags on the
                  > page) and then adjust the css in your @media:print rule accordingly.[/color]

                  This is correct.

                  --
                  Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
                  Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
                  tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

                  Comment

                  Working...