Scanner class Methods in Java

Use of other languages in HTML

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:-
JavaScript in HTML

The <style>Tag

Using <style> tag we can write code in styling language CSS. CSS is the short form of Cascading Style Sheets.

CSS is used to add styles to website so it can  look  more attractive and beautiful. CSS is popular styling language. It can format each element of HTML. click here to learn CSS.

Example:- 

<html>
<head>
<style>
h1{
color:red;
}
</style>
</head>
<body>
<h1>CSS Code in HTML </h1>
</body>
</html>

Result:-
CSS in HTML

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