- Get link
- X
- Other Apps
The <script> Tag
Using <script> tag we can write code in client-side scripting language JavaScript. JavaScript is default language for <script> tag. So, we do not need to use any attribute to specify the type of script.
JavaScript is client-side scripting language. It is used to make webpages interactive and dynamic.For example, a alert dialog box will popup on screen and user need to click ok.
Example:-
<html>
<head>
<script>
alert("This is alert box created JavaScript, Click Ok to close");
</script>
</head>
<body>
</body>
</html>
Result:-
The <style>Tag
Using <style> tag we can write code in styling language CSS. CSS is the short form of Cascading Style Sheets.
Example:-
<html>
<head>
<style>
h1{
color:red;
}
</style>
</head>
<body>
<h1>CSS Code in HTML </h1>
</body>
</html>
Result:-
NOTE:- <style> and <script> tags can be placed within <head> or <body> tags only. It is better to use in head instead of body tag.
Try using these tags by yourself. Happy Coding!
Comments
Post a Comment
If you have any doubt, ask here