228k views
13 votes
Write a script in HTML for displaying your name in brown color.

1 Answer

9 votes

Answer:

I don't quite understand the question. If you mean "create page in HTML", see image 2. If you mean "create script that is placed in the HTML page", see image 1

HTML is not a programming language. It is a markup language. You should write scripts in JavaScript or other programming languages.

1

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

</head>

<body>

<h1>Hello world!</h1>

<*cript>

function paint() {

document.querySelector("h1").style.color = "brown";

}

setTimeout(paint, 2000)

</*cript>

</body>

</html>

2

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<style>

h1 {

color: brown;

}

</style>

</head>

<body>

<h1>Hello world!</h1>

</body>

</html>

Write a script in HTML for displaying your name in brown color.-example-1
Write a script in HTML for displaying your name in brown color.-example-2
User WPrecht
by
5.3k points