Introduction to web server& Html tags(h1,h2,p,img)

Introduction to web server& Html tags(h1,h2,p,img)

Introduction to web server:-

A web server is a software application that is responsible for handling client requests and sending responses over the internet. It delivers web content such as web pages, images, videos, and other files to clients, which could be web browsers, mobile devices, or other web servers.

HTTP (Hypertext Transfer Protocol) is the protocol used for communication between web servers and clients. It's a stateless protocol that works on the request-response model. When a client makes an HTTP request to a web server, the server processes the request and sends a response back to the client. HTTP requests and responses are typically sent over TCP/IP (Transmission Control Protocol/Internet Protocol) connections.

HTTP requests and responses have different parts, including:

  1. Request line - This contains the method (such as GET, POST, etc.), the resource path, and the HTTP version.

  2. Request headers - These provide additional information about the request, such as the user-agent, the content type, and the Accept-Encoding.

  3. Request body - This contains the data sent in a POST or PUT request.

  4. Status line - This contains the HTTP version, the status code (such as 200 OK or 404 Not Found), and a brief message about the status.

  5. Response headers - These provide additional information about the response, such as the content type, the cache control, and the server type.

  6. Response body - This contains the actual data being sent to the client, such as an HTML page or an image.

Web servers use HTTP to receive and process requests from clients, retrieve the requested resource, and send a response back to the client with the requested resource. HTTP is essential for the proper functioning of the World Wide Web as it enables the transfer of information and resources over the internet.

Html tags(h1,h2,p,img)

Here are examples of the HTML tags <h1>, <h2>, <p>, and <img>:

  1. <h1> and <h2> - These tags are used for headings and subheadings in a web page.
phpCopy code<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <h2>About Me</h2>
    <p>My name is Ranga and I am a web developer.</p>
</body>
</html>

In this example, the <h1> tag is used for the main heading of the web page, while the <h2> tag is used for a subheading. The <p> tag is used for a paragraph of text.

  1. <p> - This tag is used for paragraphs of text in a web page.
phpCopy code<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <h2>About Me</h2>
    <p>My name is Ranga and I am a web developer. I have been developing websites for over 5 years and I love what I do.</p>
    <p>This is another paragraph of text.</p>
</body>
</html>

In this example, two <p> tags are used for two paragraphs of text.

  1. <img> - This tag is used for images in a web page.
phpCopy code<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
</head>
<body>
    <h1>Welcome to My Website</h1>
    <h2>About Me</h2>
    <p>My name is Ranga and I am a web developer.</p>
    <img src="example.jpg" alt="Example Image">
</body>
</html>

In this example, the <img> tag is used to display an image in the web page. The src attribute is used to specify the image file, while the alt attribute provides alternative text for the image in case the image cannot be displayed.