HTML Examples

Find Your Location

 

Click the button to get your coordinates.

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick=”getLocation()”>Try It</button>

<p id=”demo”></p>

<script>
var x = document.getElementById(“demo”);

function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = “Geolocation is not supported by this browser.”;
}
}

function showPosition(position) {
x.innerHTML = “Latitude: ” + position.coords.latitude +
“<br>Longitude: ” + position.coords.longitude;
}
</script>

</body>
</html>

 

Play Video in HTML

<!DOCTYPE html>
<html>
<body>

<video width=”320″ height=”240″ controls>
<source src=”video.mp4″ type=”video/mp4″>

</video>

</body>
</html>

 

 

 

Table in HTML and CSS

 

 

HTML Table

table
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 6px;
}

tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>

<h2>HTML Table</h2>

<table>
<tr>
<th>SN</th>
<th>Name</th>
<th>Address</th>
</tr>
<tr>
<td>1</td>
<td>Prajwal</td>
<td>Nepal</td>
</tr>

<tr>
<td>2</td>
<td>Roshan Budhathoki</td>
<td>Jhapa, Nepal</td>
</tr>
<tr>
<td>3</td>
<td>Ganesh Majhi</td>
<td>Dubai</td>
</tr>

<tr>
<td>4</td>
<td>Dilip Rajbanshi</td>
<td>Rara, Nepal</td>
</tr>

<tr>
<td>5</td>
<td>Adit Dhungyel</td>
<td>Sydney, Australia</td>
</tr>
</table></body></html>

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image