Forum Moderators: not2easy

Message Too Old, No Replies

Hiding webbots in print style sheet

Can I use display:none to hide webbot includes?

         

mooperlee

1:13 pm on Apr 23, 2007 (gmt 0)

10+ Year Member



I am making a print style sheet for my first ever html/css website, and I am trying to hide all the stuff like navigation elements etc so they don't print. This is no problem as they are in divs and I am just putting in display:none in the appropriate div.

However, I can't work out how to hide the adverts, as I haven't put these in their own divs. Instead they are inserted using Frontpage includes, which means the code looks like this:

<!--webbot bot="Include" U-Include="adverts.htm" TAG="BODY" -->

Is there any way to apply display:none to webbots or includes alone? Or will I need to go through and put the webbots into their own separate div, and then hide the div?

Thanks very much for any ideas.

Philosopher

1:23 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Unless when the webbot generates the content it does so using some type of targetable id etc, then your best bet is to go through them an place them in their own div.

mooperlee

4:54 pm on Apr 23, 2007 (gmt 0)

10+ Year Member



Thanks for your reply. Does sound like I'll need to use divs.

The only thought I had was that the ads are mainly javascript - is there any way to use display:none to hide all scripts or all javascript?

Philosopher

5:17 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try

script{
display: none;
}

That may work (but I've never tried it.)

SuzyUK

5:26 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



can you not wrap the webbot include code in a div (rather than add it to each of the included pages)

<div id="myinclude"><!--webbot bot="Include" U-Include="adverts.htm" TAG="BODY" --></div>

#myinclude {display: none;}

or

#myinclude iframe {display: none;}

where you could change 'iframe' to whatever element the ads script generates if you want to get more choosy over what you hide

Dabrowski

5:38 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think Suzy's way would certainly be the easiest, just hide the whole lot.

script{
display: none;
}

CSS is for styling visible elements, <script> is NOT a visible element, there's no way you could affect it like this. The only thing you could do is write styles for the elements the script produces, but that would be far harder than just hiding the whole lot in a div.

mooperlee

8:25 pm on Apr 25, 2007 (gmt 0)

10+ Year Member



I have tried Suzy's solution, and it works like a charm. Thanks very much for all your suggestions.