Hello Friends,

I have a simple problem, in my HTML page I want to display a paragraph and link but do not want to print it. Please guide me how to use CSS to achieve this.

Hi,
it can be help you,

hi that's link
<a href="hell.html" style="color:black; filter:Glow(color=#ff0000, strength=12);">Click here!</a>

Hello Friends,

I have a simple problem, in my HTML page I want to display a paragraph and link but do not want to print it. Please guide me how to use CSS to achieve this.

Friends problem has been solved. Here is the solution,

Create a new external style sheet in notepad and save it as a print.css, then type in the following-

#notprint {
  display : none;
}

then save it.

Insert following in your HTML page between <HEAD></HEAD>

<LINK rel="stylesheet" type="text/css" name="style1" href="print.css" [B]media="print"[/B]>

Next step is use the following <div></div> which ever you do not want to print (image, text etc)

<div id="other" name="other"> This line will be displayed but not print </div>

Regards!!

Use separate styles for the same class.
For example,

@media screen
{
.sampleClassParagraph
{
display:block;
}
.sampleClassLink
{
text-decoration:underline;
}
}
@media print
{
.sampleClassParagraph
{
display:none;
}
.sampleClassLink
{
text-decoration:none;
}
}

The HTML elemnts which uses the above CSS will display the styles on screen. When printing, the styles will be removed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.