em tag in html with example
- The <em> tag is used to indicate emphasis (less emphasis than the HTML strong tag).
- The <em> element is one of the phrase elements in HTML. The appearance of text enclosed within a <em> element is often rendered with an italic font.
- The <em> tag is supported in all major browsers.
Example :
<html>
<head>
<title>EM</title>
</head>
<body>
I love <em>Football.</em>
This is <em>20Fingers2Brains</em>
</body>
</html>
Demo :
In the above example, we have rendered em element. The em element is rendered in italics style.
em and Style :
<html>
<head>
<title>EMStyle</title>
<style type="text/css">
em
{
color:green;
font-size:20px;
font-family:comic sans ms;
}
</style>
</head>
<body>
I love <em>Football.</em><br/>
This is <em>20Fingers2Brains</em>
</body>
</html>
Demo :
In the above example, we have rendered em tag. We have also applied CSS to it.
em and Javascript :
<html>
<head><title>EMJavascript</title>
<style type="text/css">
</style>
<script type="text/javascript">
function em()
{
var element=document.createElement("em");
var text=document.createTextNode("This is Emphasized effect.");
element.appendChild(text);
document.getElementById("em").appendChild(element);
}
</script>
</head>
<body>
<div id="em">
</div>
<input type="button" id="b1" value="Press" onclick="em()">
</body>
</html>
Demo :
In the above example, we have rendered em tag on button click.
0 comments:
Post a Comment