Italic tag in html with examples
- The HTML <i> tag renders text in italic style.
- The <i> tag defines a part of text in an alternate voice or mood. The <i> tag is typically displayed in italic type.
- The <i> tag can be used to indicate a technical term, a phrase
- from another language, a thought, or a ship name, etc.
- The <i> tag is supported in all major browsers.
Example :
<html>
<head>
<title>I</title>
</head>
<body>
<i>Welcome to 20Fingers2Brains.</i>
</body>
</html>
Demo :
In the above example, we have rendered italic element. It renders the text in italic style.
I and Style :
<html>
<head>
<title>IStyle</title>
<style type="text/css">
i
{
color:green;
font-size:30px;
margin-left:350px;
font-weight:bold
}
</style>
</head>
<body>
<i>Welcome to 20Fingers2Brains.</i>
</body>
</html>
Demo :
In the above example, we have rendered italic element and created a CSS class. We have also applied CSS to the rendered italic element.
Italic and Javascript :
<html>
<head><title>IJavascript2</title>
<style type="text/css">
i
{
color:green;
font-size:30px;
font-weight:bold
}
</style>
<script type="text/javascript">
function i()
{
var e=document.createElement("i");
var text=document.createTextNode("Welcome to 20Fingers2Brains.");
e.appendChild(text);
document.getElementById("i").appendChild(e);
}
</script>
</head>
<body>
<div id="i">
</div>
<input type="button" id="b1" value="Press" onclick="i()"/>
</body>
</html>
Demo :
In the above example, we have used javascript to create a italic tag and rendered it on UI.
0 comments:
Post a Comment