cite tag in html with examples






  1. The HTML <cite> tag is used for indicating a citation. It's rendered in italic text in most browsers.
  2. The <cite> tag is supported in all major browsers.

Example :

     <html>
     <head>
     <title>Cite</title>
     </head>
     <body>
     <p>This is text without cite effect.</p>
     <cite>This is text with cite effect.</cite>
     </body>
     </html>
     

Demo :





In the above example, we have rendered a paragraph and cite element. The cite element is rendered in italic font.



Cite and Style :



<html>
<head>
<title>CiteStyle</title>
<style type="text/css">
cite
{
font-family:comic sans ms;
color:blue;
font-size:20px;
}
</style>
</head>
<body>
<p>This is text without cite effect.</p>
<cite>This is text with cite effect.</cite>
</body>
</html>

Demo :





In the above example, we have rendered a cite element. We have applied CSS to it.



Cite and Javascript :



<html>
<head><title>CiteJavascript</title>
<script type="text/javascript">
function cite()
{
var element=document.createElement("cite");
var text=document.createTextNode("This is cite effect.");
element.appendChild(text);
document.getElementById("cite").appendChild(element);
}
</script>
</head>
<body>
<div id="cite">
</div>
<input type="button" id="b1" value="Press" onclick="cite()">
</body>
</html>
     

Demo :




In the above example, we have rendered a button. On click of this button the cite element is created and rendered.


0 comments:

Post a Comment