Loading Order Of Images Is Not Same As Order The Images Were Programmed

-second-
Paul,
What I did was after the
</style>
I put in
<style type=“text/css” media=“print”>
body {visibility: hidden; display: none;}
</style>
and print preview showwed no text, so I guess it works.

I have no idea why
@media print{body{display:none}}

stopped working.

Chris

You’re calling a nonexistent function in the function. In that case you need print “body{display:none}”; But, you’re better off just throwing that in an external style sheet with your other styles and using <link> to call it at the start of the document so that you don’t needlessly add code and levels of complication to your code. Plus the aforementioned caching issue.

All you need to do is view source once the page is displayed in the browser and then you will see where the error is occuring. The browser only understands html and knows nothing of php because all it receives is html.

I’m guessing that you had the rules outside of the style tags.


<style type="text/css">
@media print{body{display:none}} 
</style>

Edit:

Looks like it was php question anyway which was answered above :slight_smile:

Paul, Bels,
Got it.

Thanks,

Chris

Paul,
Congrats on your award - 2011 CSS Guru

Chris

Thanks :slight_smile:

Paul,
Is is better to use

<style type=“text/css”>
@media print{body{display:none}}
</style>

than

<style type=“text/css”>
body {visibility: hidden; display: none;}
</style>

Thanks,

Chris

Why would you want to hide the whole page for printing?

display:none collapses the element as though it doesn’t exist. Visibility:hidden on the other hand just makes the element invisible but it still takes up space on the page.

Paul,
I think you’re saying that becuase display:none collapses the element as though it doesn’t exist, writing visibility: hidden makes no sense since you can’t hide something that doesn’t exist.

So how about
<style type=“text/css” media=“print”>
@media print{body{display:none}}

versus
style type=“text/css” media=“print”>
body {hidden; display: none}

It seems like @media print is redundant because "media=“print” is in the line before.

Thanks Paul,

Chris

Chris

Yes on both counts :slight_smile:

Paul,

So that would make
<style type=“text/css” media=“print”>
@media print{body{display:none}}
inefficient

that seems to leave only
style type=“text/css” media=“print”>
body {hidden; display: none}

as the best way ?

Thanks,

Chris

What is the purpose of hiding all the printed output? I’m a little confused as to what you are doing there.

To answer your question you only need body{display:none} to hide all the content.

Your first example would be pointless as you have limited the stylesheet to print anyway so no need for the extra media query. You would use the @media rule in a stylesheet where media=“all” so that you can target media separately inside that stylesheet using the @media rule.

I mean body {display: none}

That must be it, it’s working fine. Five years of tweaking and I think I’m actually done. Sitepoint helped for 3 or 4 of those years. Thanks for the help !!