Computer Science, asked by sumitrandls, 6 hours ago

Q8. Write a program in HTML
to print "Hello, World!". The
text should be displayed in
center​

Answers

Answered by Anonymous
62

Answer:

<html lang="en">

 <head>

   <title>Your Title</title>

 </head>

 <body>

   <h1 style="text-align: center">Hello, World!</h1>

 </body>

</html>

Explanation:

  • You can use any text tag like h2 or p tag for the displaying text
  • To center the text we use styling property text-align

and assign it center

Answered by Anonymous
76

Hello world - HTML

Before we print Hello world in center, let's first know about HTML.

HTML is the hypertext markup language, it is the standard markup language, it is used for creating web pages, it's consist of a series elements. HTML elements tell the browser, how to display the content.

Here, we will use <p> tag to print 'Hello World!' and we will use text align for center. <p> tag is used for paragraph, it defines the paragraph of the HTML document.

\rule{300}{1}

The Cօde

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<p style="text-align:center">Hello World!</p>

</body>

</html>

\rule{300}{1}

The Output

The output of the given program will be as follows:

Hello World!

Similar questions