HTML id Attribute

HTML id Attribute

HTML id Attribute

HTML id Attribute

HTML id Attribute

HELLO WORLD

html
<!DOCTYPE html>
<html>
<head>
  <title>HTML id Attribute</title>
<style>
#hello {
  background-color: Khaki;
  color: black;
  padding: 50px;
  text-align: center;
  border-radius: 5px;
} 
</style>
</head>
<body>

<h3>HTML id Attribute</h3>

<h1 id="hello">HELLO WORLD</h1>

</body>
</html>

Difference between ID and Class

Difference between ID and Class

Difference between ID and Class

HELLO WORLD

New Delhi is the capital of India

html
<!DOCTYPE html>
<html>
<head>
  <title>Difference between ID and Class</title>
<style>

#hello-world {
  background-color: Khaki;
  color: black;
  padding: 30px;
  text-align: center;
  border-radius: 10px;
}

.india {
  background-color: DarkOrange;
  color: white;
  padding: 30px;
  border-radius: 10px
} 
</style>
</head>
<body>

<h3>Difference between ID and Class</h3>

<h3 id="hello-world">HELLO WORLD</h3>

<h3 class="india">New Delhi is the capital of India</h3>

</body>
</html>
HTML Bookmarks with ID and Links

Jump to Math

Jump to English

Jump to Computer

Jump to History

Jump to Geography

Jump to Art

Jump to Social Sciences

Jump to Biology

Jump to Physics

Jump to Chemistry

Subject 1

Math

Subject 2

English

Subject 3

Computer

Subject 4

History

Subject 5

Geography

Subject 6

Art

Subject 7

Social Sciences

Subject 8

Biology

Subject 9

Physics

Subject 10

Chemistry

html
<!DOCTYPE html>
<html>
<head>
 <title>HTML Bookmarks with ID and Links</title>
</head>
<body>

<p><a href="#s1">Jump to Math</a></p>
<p><a href="#s2">Jump to English</a></p>
<p><a href="#s3">Jump to Computer</a></p>
<p><a href="#s4">Jump to History</a></p>
<p><a href="#s5">Jump to Geography</a></p>
<p><a href="#s6">Jump to Art</a></p>
<p><a href="#s7">Jump to Social Sciences</a></p>
<p><a href="#s8">Jump to Biology</a></p>
<p><a href="#s9">Jump to Physics</a></p>
<p><a href="#s10">Jump to Chemistry</a></p>

<h6 id="s1">Subject 1</h6>
<p>Math</p>

<h6 id="s2">Subject 2</h6>
<p>English</p>

<h6 id="s3">Subject 3</h6>
<p>Computer</p>

<h6 id="s4">Subject 4</h6>
<p>History</p>

<h6 id="s5">Subject 5</h6>
<p>Geography</p>

<h6 id="s6">Subject 6</h6>
<p>Art</p>

<h6 id="s7">Subject 7</h6>
<p>Social Sciences</p>

<h6 id="s8">Subject 8</h6>
<p>Biology</p>

<h6 id="s9">Subject 9</h6>
<p>Physics</p>

<h6 id="s10">Subject 10</h6>
<p>Chemistry</p>

</body>
</html>

ID Attribute in JavaScript

Using The ID Attribute in JavaScript

HELLO WORLD

html
<!DOCTYPE html>
<html>
<head>
 <title>
  Using The ID Attribute in JavaScript
 </title>
</head>
<body>

<h3 id="HELLO">HELLO WORLD</h3>
<button onclick="DisplayResult()">Change text</button>

<script>
function DisplayResult() {
  document.getElementById("HELLO").innerHTML = "Using The ID Attribute in JavaScript";
}
</script>

</body>
</html>