HTML01 Write HTML code to develop a Web page having the background in red and title “My First Page” in any other colour

By | January 6, 2018

Write HTML code to develop a Web page having the background in red and title “My First Page” in any other colour.

HTML stands for HyperText Markup Language. HTML provides a way of displaying Web pages with text and images or multimedia content. HTML is not a programming language, but a markup language. An HTML file is a text file containing small markup tags. The markup tags tell the Web browser, such as Internet Explorer or Netscape Navigator, how to display the page. An HTML file must have an htm or html file extension.

HTML pages are of two types:

  •  Static
  • Dynamic

 

 Static Pages

Static pages, as the name indicates, comprise static content (text or images). So you can only see the contents of a web page without being able to have any interaction with it.

 

Dynamic Pages

Dynamic pages are those where the content of the web page depend on user input. So interaction with the user is required in order to display the web page. For example, consider a web page which requires a number to be entered from the user in order to find out if it is even or odd. When the user enters the number and clicks on the appropriate button, the number is sent to the web server, which in turn returns the result to the user in an HTML page.

 

BASIC TAGS OF HTML

Let us now look at tags in more detail. A <TAG> tells the browser to do something. An ATTRIBUTE goes inside the <TAG> and tells the browser how to do it. A tag can have several attributes. Tags can also have default attributes. The default value is a value that the browser assumes if you have not told it otherwise. A good example is the font size. The default font size is 3. If you say nothing the size attribute of the font tag will be taken to have the value 3.

 

Write HTML code to develop a Web page having the background in red and title “My First Page” in any other colour.

 

HTML_MyFirstPage_Source_Code

 

HTML_MyFirstPage

Html code:

[codesyntax lang=”html4strict”]

<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>My First Page</TITLE>
</HEAD>
<BODY BGCOLOR="red">
</BODY>
</HTML>

[/codesyntax]

Write above code in any text editor and save by htm or html extension and Open it in any browser by double clicking the file like internet explorer.

 

<!DOCTYPE html>

This tag defines the document type and HTML version.

 

<HTML>….</HTML>

This tag encloses the complete HTML document and mainly comprises of document header which is represented by <head>…</head> and document body which is represented by <body>…</body> tags.

 

<HEAD>….</HEAD>

This tag represents the document’s header which can keep other HTML tags like <title>, <link> etc.

 

<TITLE>My First Page</TITLE>

The <title> tag is used inside the <head> tag to mention the document title.

 

Note: Title has no Font Color attributes hence couldn’t change its colour.

 

<BODY BGCOLOR=”red”>…</BODY>

This tag represents the document’s body which keeps other HTML tags like <h1>, <div>, <p> etc.

 

The BODY tag has following attributes:

  1. BGCOLOUR: It can be used for changing the background colour of the page. By default the background colour is white.
  2. BACKGROUND: It is used for specifying the image to be displayed in the background of the page.
  3. LINK: It indicates the colour of the hyperlinks, which have not been visited or clicked on.
  4. ALINK: It indicates the colour of the active hyperlink. An active link is the one on which the mouse button is pressed.
  5. VLINK: It indicates the colour of the hyperlinks after the mouse is clicked on it.
  6. TEXT: It is used for specifying the colour of the text displayed on the page.

 

The <!DOCTYPE> Declaration

The <!DOCTYPE> declaration tag is used by the web browser to understand the version of the HTML used in the document. Current version of HTML is 5 and it makes use of the following declaration:

<!DOCTYPE html>

There are many other declaration types which can be used in HTML document depending on what version of HTML is being used. We will see more details on this while discussing <!DOCTYPE…> tag along with other HTML tags.

 

Note:- To understand program for sequence in detail Please SEARCH numerically example. HTML01, HTML02, etc