HTML unit 2-1

 HTML-Forms

In HTML, a form is used to collect user input. It allows you to gather data from users and send it to a server for processing.

To create a form in HTML, use the <form> element, along with various form controls such as <input>, <textarea>, <select>, and <button>

For example:

<!DOCTYPE html>
<html>
<body>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<label for="message">Message:</label>
<textarea id="message" name="message"></textarea><br><br>

<button type="submit">Submit</button>
</form>
</body>
</html>

output:- image-01 


 

 

 

 

 

INPUT-TPYES:- 

HTML provides several types of input elements, which can be used to take user input. Some of the most commonly used input types are:

  1. Text: Used to take single-line text input, represented by the "text" input type.

  2. Password: Used to take password input, represented by the "password" input type. The characters entered by the user are masked to protect sensitive information.

  3. Radio: Used to provide a list of mutually exclusive options, represented by the "radio" input type. Only one option can be selected at a time.

  4. Checkbox: Used to provide a list of options that can be selected independently, represented by the "checkbox" input type. Multiple options can be selected.

  5. Submit: Used to submit a form, represented by the "submit" input type.

  6. Reset: Used to reset the form to its original state, represented by the "reset" input type.

  7. Button: Used to create a clickable button, represented by the "button" input type.

  8. Hidden: Used to store a value that is not displayed to the user, represented by the "hidden" input type.

  9. File: Used to upload a file, represented by the "file" input type.

  10. Image: Used to take an image as input, represented by the "image" input type.

  11. Number: Used to take numeric input, represented by the "number" input type.

  12. Range: Used to take a range of values as input, represented by the "range" input type.

  13. Date: Used to take a date as input, represented by the "date" input type.

  14. Time: Used to take a time as input, represented by the "time" input type.

  15. Color: Used to select a color, represented by the "color" input type.

These are the most commonly used input types in HTML.

  • <input type="button">
  • <input type="checkbox">
  • <input type="color">
  • <input type="date">
  • <input type="datetime-local">
  • <input type="email">
  • <input type="file">
  • <input type="hidden">
  • <input type="image">
  • <input type="month">
  • <input type="number">
  • <input type="password">
  • <input type="radio">
  • <input type="range">
  • <input type="reset">
  • <input type="search">
  • <input type="submit">
  • <input type="tel">
  • <input type="text">
  • <input type="time">
  • <input type="url">
  • <input type="week">

 

INPUT-Attribute:-

 

The "input" element in HTML can have several attributes that are used to control and modify its behavior and appearance. Some of the most commonly used input attributes are:

  1. name: Specifies a name for the input element that can be used to access its value in a script.
  2. id: Specifies a unique identifier for the input element that can be used to style it with CSS.
  3. value: Specifies the initial value of the input element.
  4. type: Specifies the type of input element, such as text, password, radio, checkbox, submit, reset, button, file, image, number, range, date, time, or color.
  5. disabled: Specifies that the input element should be disabled, so that the user cannot interact with it.
  6. readonly: Specifies that the input element should be read-only, so that the user can only view its value and cannot modify it.
  7. required: Specifies that the input element must be filled out before the form can be submitted.
  8. placeholder: Specifies a short hint that describes the expected value of the input element.
  9. pattern: Specifies a regular expression that the input value must match in order to be valid.
  10. maxlength: Specifies the maximum number of characters that can be entered into the input element.
  11. size: Specifies the width of the input element, in characters.
  12. src: Specifies the source URL of the image for an "image" input type.
  13. alt: Specifies alternative text for an "image" input type.
  14. checked: Specifies that a "checkbox" or "radio" input type should be selected by default.
  15. min and max: Specifies the minimum and maximum values that can be entered into a "number" or "range" input type.

These are some of the most commonly used input attributes in HTML.

program:-code:02

<!DOCTYPE html>
<html>
<body>
<h1>The input value attribute to form</h1>
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html> 

output:-image-02


 

 

 

 

HTML-GRAPHICS:-

HTML graphics refer to the process of creating visual content within a website using HTML code. The two main ways to create graphics in HTML are by using HTML elements like <img> and <canvas>, or by using CSS styles to create visual elements like shapes, background images, and animations.

The <img> element is used to display images on a web page. It requires a source attribute that specifies the URL of the image to be displayed, like this: <img src="image.jpg">.

The <canvas> element provides a way to create dynamic graphics and animations using JavaScript. It provides a 2D drawing surface that can be used to draw shapes, images, and text. For example:code:03

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML-Graphics</title>
</head>
<body>
<canvas id="myCanvas" width="300" height="150"></canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 50, 50);
</script>
<div style="background-image: url(image.jpg); background-color: green; border-radius: 50%; width: 200px; height: 200px;"></div>
</body>
</html> 

ouput:-image-03


 

 

 

  

 

 

 

 

 

Graphics svg :- 

SVG (Scalable Vector Graphics) is a vector graphics format used for displaying graphics on the web. Unlike raster graphics, which use pixels to represent images, SVG uses mathematical equations to describe graphics. This means that SVG graphics can be scaled up or down without losing quality, making it ideal for use on the web.

SVG graphics are created using XML code, which can be embedded directly into an HTML document. For example

 <svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="blue"/>
</svg>

The above code creates a blue circle with a radius of 40 units and a center point at (50, 50). The width and height of the SVG element are set to 100 units each.

In addition to basic shapes like circles, rectangles, and polyglines, SVG also supports more complex graphics, including gradients, patterns, and masks. It also supports interactivity through the use of JavaScript, allowing for dynamic and animated graphics.

SVG has many advantages over raster graphics, including smaller file sizes, better scalability, and better accessibility. However, it may not be the best choice for all types of graphics, as it does not support as many features as raster formats like JPEG or PNG. For example, it does not support variable transparency levels for individual pixels.

MULTIMEDIA:-

HTML multimedia refers to the use of various media types in HTML documents, including images, audio, video, and animations. These elements can be added to an HTML page using HTML tags and attributes, along with supporting technologies such as CSS and JavaScript.

Here are some common HTML multimedia elements:

  • <img>: This tag is used to embed images in an HTML document. The src attribute specifies the URL of the image file.

  • <audio>: This tag is used to embed audio files in an HTML document. The src attribute specifies the URL of the audio file.

  • <video>: This tag is used to embed video files in an HTML document. The src attribute specifies the URL of the video file.

  • <canvas>: This tag is used to create dynamic graphics and animations in an HTML document using JavaScript.

  • <svg>: This tag is used to embed scalable vector graphics in an HTML document.

Multimedia elements can be customized using CSS and JavaScript to create rich and engaging user experiences. For example, you can use CSS styles to control the size, position, and appearance of images, and JavaScript to add interactivity to video and audio elements.

It's important to keep in mind that different browsers support different multimedia formats, so it's a good idea to use multiple formats to ensure that your content can be accessed by as many users as possible. For example, you might use both MP4 and WebM formats for video, and both MP3 and Ogg formats for audio.

CODE:04

<!DOCTYPE html>
<html>
<body>
<h1>image</h1>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXPIS8C2oNXxZh6GKeNqrjCRdtsS-0Jk4tHqrT7uevXrzbl5vsFCgy7wkbrhY673OVqHx-Y11JYzDcPJiH5Dc3I_vc2EC8q1cXWznyBykMQnijZGYDYF07KMAMdGXoPVmI69CwEAq1QAk5UhM-R2c9KxEanvBVB4Q1gLqk2dHcjTPIB6dl1tte2m0TbA/s628/ibm-new-logo.jpg"width="320" height="240"><br>
<h1>aduio</h1>
<audio controls="">
<source src="01.mp3" type="audio/mp3"></source>
</audio><br>
<h1>video</h1>
<video width="320" height="240" controls>
<source src="01.mp4" type="video/mp4">
</video><br>
<h1>canvas-graphics</h1>
<canvas id="myCanvas" width="300" height="150"></canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 50, 50);
</script><br>
<h1>svg-graphics</h1>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="blue"/>
</svg><br>
</body>
</html>

 

 output:-image-04


 

  

 

Comments

Popular posts from this blog

digital marketing ppt-u1

SOFTWARE

cn lab

Computer Operations and Performing - D L Unit-1-1

DS-Record-mca-04) write a program for evaluating a given postfix expression using stack.

DBMS Degree Lab Records

Unit 2: Foundations of Ownership, Security Related Concepts in Blockchain

Unit-1 Foundations of Software Systems and Blockchain

Access the Internet to Browse Infromation & E-Mail Operation- D L Unit-2-1

6)what are the various service of internet and protocols ICT-unit-1