473,378 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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=print(display:none)">)

Thanks

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

-=- geotso -=-
(remove the TRAP to contact me)
Jul 20 '05 #1
8 35557
"geotso" <ge********@hotmail.com> wrote in message
news:bs**********@usenet.otenet.gr...
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=print(display:none)">)


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
Jul 20 '05 #2

"geotso" <ge********@hotmail.com> wrote in message
news:bs**********@usenet.otenet.gr...
Is there a way to hide these two paragraphs with an inline style?


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.
Jul 20 '05 #3
Neal wrote:
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.

--
Spartanicus
Jul 20 '05 #4

"Spartanicus" <me@privacy.net> wrote in message
news:8c********************************@news.spart anicus.utvinternet.ie...
Neal wrote:
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.

--
Spartanicus


http://www.w3.org/TR/xhtml11/doctype.html

Unless I'm screwed up... which IS possible...
Jul 20 '05 #5
Neal wrote:
>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.


http://www.w3.org/TR/xhtml11/doctype.html

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


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
Jul 20 '05 #6
Spartanicus wrote:
Neal wrote:

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.


http://www.w3.org/TR/xhtml11/doctype.html

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

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


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.annevankesteren.nl/>
Jul 20 '05 #7
"geotso" <ge********@hotmail.com> wrote in message
news:bs**********@usenet.otenet.gr...
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]

@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
Jul 20 '05 #8
In article news individual wrote:
"geotso" <ge********@hotmail.com> wrote in message
news:bs**********@usenet.otenet.gr...
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]
@media print{
{
h1:display:none;
}
{p:display:none;
}
}

This will hide every h1 and p element from printing.


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

Correct syntax:

@media print {
h1,p {display:none;}
}
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.


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.

Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: paul haine | last post by:
Hi, Let's say I have a paragraph that's using inline styles, like this: <p style="float: left; width: 50%;"> blah blah blah </p> Does anybody know how (or even if it's possible) to use...
5
by: Viken Karaguesian | last post by:
Hello all, It seems to me that IE ignores other styles altogether when an inline style is used. As an example, check my site (in my signature file). In the "Latest News and Headlines" you can...
4
by: Schraalhans Keukenmeester | last post by:
I recently discovered the value of tidy for my html adventures. Nice little app. Only one thing is becoming a bit of a drag. If I use tidy to clean up my code, it inserts the following in every...
3
by: MIS Director | last post by:
Is there any tool out there that will analyze an entire website and produce a report of inline style usages by both total count and detail occurrances. This would produce a list of possible...
3
by: pankajit09 | last post by:
Hello, The HTML code is like this --> <a href="#searchanchor">Go to Top</a> I want to position the "Go to Top" in the center . One way is like this -->
0
by: Evan M. | last post by:
Hello, What's the simplest way to remove the inline style's that get added to a Menu control's items when it is rendered? More specifically, I want to remove the "cursor:text" element that's...
0
by: Mike | last post by:
Hi, I have a strange problem: I wrote a reverse proxy that redirects pages to a local or remote server. Everything seems to work fine, but I have a strange problem with inline styles. In my...
1
by: rbaulbin | last post by:
Hello - Does anyone know if of a utility that can traverse an HTML file for all inline CSS style tag occurrences and generate an external style sheet from them, and then create (intelligent?)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.