HTML Articles

Page 67 of 151

How do we style HTML elements using the division tag ?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 602 Views

The tag is used as a container for HTML elements. It helps define sections within an HTML document and groups large sections of HTML elements together for easy formatting. The tag is a block-level element that accepts all CSS properties and can be styled using attributes like class and id. The div tag is primarily used for − Grouping elements − Combining related HTML elements into logical sections Layout structure − Creating page layouts with headers, sidebars, and content areas CSS styling − Applying styles to multiple elements at once JavaScript manipulation − Targeting groups ...

Read More

How to draw shapes using SVG in HTML5?

Daniol Thomas
Daniol Thomas
Updated on 16-Mar-2026 2K+ Views

SVG (Scalable Vector Graphics) is a language for describing 2D graphics and graphical applications in XML format. The XML is rendered by an SVG viewer, and most modern web browsers can display SVG just like they display PNG, GIF, and JPG images. SVG graphics are vector-based, making them scalable without quality loss at any size. You can draw various shapes like circles, rectangles, lines, polygons, and more using SVG in HTML5. SVG elements are embedded directly in HTML and can be styled with CSS or manipulated with JavaScript. Syntax Following is the basic syntax for embedding SVG ...

Read More

How to draw a star by using canvas HTML5?

Nancy Den
Nancy Den
Updated on 16-Mar-2026 10K+ Views

Drawing on the HTML canvas is done with JavaScript. The canvas element provides a drawable region controlled by scripting APIs. To draw a star in HTML5, we use the element combined with JavaScript's Canvas API methods like moveTo(), lineTo(), and fill(). The canvas drawing process requires getting the canvas element using getElementById() and obtaining the 2D rendering context with getContext('2d'). Once we have the context, we can draw shapes by defining paths and filling or stroking them. Syntax Following is the basic syntax for creating a canvas and drawing on it − ...

Read More

How to draw an SVG file on an HTML5 canvas?

Vrundesha Joshi
Vrundesha Joshi
Updated on 16-Mar-2026 14K+ Views

To draw an SVG file on an HTML5 canvas, you need to convert the SVG into an image format that the canvas can render. The canvas element cannot directly draw SVG markup, but it can draw Image objects. This process involves creating an SVG string, converting it to a Blob, generating an object URL, and then drawing it using the drawImage() method. Syntax Following is the basic syntax for drawing SVG on canvas − var svgString = '...'; var blob = new Blob([svgString], {type: 'image/svg+xml'}); var url = URL.createObjectURL(blob); var img = new Image(); img.onload = ...

Read More

What is difference between vs. ?

Swarali Sree
Swarali Sree
Updated on 16-Mar-2026 2K+ Views

In HTML, the element and serve similar purposes but have important differences. The element can contain rich content like text, images, and other HTML elements, while can only display plain text through its value attribute. Syntax Following is the syntax for the element − Content Following is the syntax for − HTML Element The element is used for creating interactive buttons within HTML forms or anywhere on a web page. It can contain rich content including text, images, icons, and ...

Read More

How to give a limit to the input field in HTML?

Rishi Raj
Rishi Raj
Updated on 16-Mar-2026 6K+ Views

The HTML tag is used to collect user input in web forms. To give a limit to the input field, use the min and max attributes, which specify the minimum and maximum values for an input field respectively. The min and max attributes work with number, range, date, datetime-local, month, time, and week input types. These attributes help validate user input on the client side and provide better user experience by preventing invalid entries. Syntax Following is the syntax for setting input limits using the min and max attributes − For ...

Read More

How to allow multiple file uploads in HTML forms.

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 19K+ Views

In this article, we will learn how to allow multiple file uploads in HTML forms. The multiple attribute enables users to select and upload several files at once through a single input field, providing a more efficient user experience for file uploads. The multiple attribute is a boolean attribute that works with email and file input types. When applied to file inputs, it allows users to select multiple files from their device using the standard file picker dialog. Syntax Following is the syntax for enabling multiple file uploads in HTML forms − ...

Read More

How to limit the number of characters entered in a textarea in an HTML form?

Geetu Magoo
Geetu Magoo
Updated on 16-Mar-2026 15K+ Views

In HTML, we can create forms to accept and store information entered by the user with the help of various elements. The textarea is one such element that allows users to enter multiline text data, unlike regular text fields which are single-line input controls. The textarea control is commonly used for entering remarks, suggestions, address information, email body content, comments, or any text that requires multiple lines. By default, a textarea can accept up to 524, 288 characters, but we can limit this using the maxlength attribute. Syntax Following is the basic syntax for creating a textarea ...

Read More

How to use input type field with steps in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 961 Views

The step attribute in HTML input fields defines the interval between valid numbers that users can enter or select. When used with input types like number, range, date, or time, it controls the stepping behavior of spinner buttons and slider movements. For example, if step="2", the valid numbers could be -4, -2, 0, 2, 4, etc. The step attribute sets the stepping interval when clicking up and down spinner buttons in number fields or moving a slider left and right on range inputs. Syntax Following is the syntax to use the step attribute in HTML input fields ...

Read More

How to use input type field with the color picker in HTML?

Lokesh Badavath
Lokesh Badavath
Updated on 16-Mar-2026 2K+ Views

The color input type in HTML provides a user-friendly way to select colors through a built-in color picker interface. The element displays a clickable color swatch that opens a color picker dialog when activated. When a user clicks on the color input field, the browser displays a native color picker interface. The selected color value is stored as a seven-character hexadecimal string (e.g., #ff0000 for red). You can set a default color using the value attribute with a valid hexadecimal color code. Syntax Following is the syntax to use input type field with color picker in ...

Read More
Showing 661–670 of 1,509 articles
« Prev 1 65 66 67 68 69 151 Next »
Advertisements