Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
HTML Articles
Page 69 of 151
How do we reset all the input fields in HTML forms?
In HTML forms, we often need to reset all input fields to their default values. This is accomplished using the reset button, which clears all user-entered data and restores form elements to their original state. HTML provides a built-in mechanism through the element with type="reset". When clicked, this button automatically resets all form controls within the same form to their initial values − text fields become empty, checkboxes return to their default checked state, and select dropdowns revert to their default selection. Syntax Following is the syntax for creating a reset button − ...
Read MoreWhy do we use reset button in HTML forms?
The reset button is used to reset all the input fields in HTML forms to their initial values. It gets added using the tag with the type="reset" attribute. When clicked, it clears any user-entered data and restores all form elements to their original state. The reset button is particularly useful in long forms where users might want to start over without manually clearing each field. It provides a quick way to undo changes and return to the form's default state. Syntax Following is the syntax for the reset button − The ...
Read MoreHow to preselect a value in a dropdown list of items in HTML forms?
With HTML, you can easily create a simple dropdown list of items to get user input in HTML forms. A select box, also called a dropdown box, provides an option to list down various options in the form of a dropdown list. You can also preselect a value in dropdown list of items in HTML forms. For that, add the selected attribute in the tag for the value you want to preselect. Syntax Following is the syntax to preselect an option in a dropdown list − Option 1 ...
Read MoreHow to draw a circular gradient in HTML5?
HTML5 Canvas provides the createRadialGradient() method to create circular or radial gradients. This method returns a CanvasGradient object that represents a radial gradient painting along a cone defined by two circles. The gradient transitions smoothly from the inner circle to the outer circle, creating a circular gradient effect. Syntax Following is the syntax for the createRadialGradient() method − createRadialGradient(x0, y0, r0, x1, y1, r1) Parameters The createRadialGradient() method accepts six parameters that define two circles − Parameter Description x0 x-coordinate of the starting circle's center ...
Read MoreHow to draw a rectangle on HTML5 Canvas?
The HTML5 Canvas element provides a powerful way to draw graphics dynamically using JavaScript. The tag creates a drawing surface, and we use its 2D rendering context to draw shapes like rectangles, circles, and lines. To draw rectangles on canvas, we use methods like fillRect() for filled rectangles and strokeRect() for outlined rectangles. These methods require coordinates and dimensions to position and size the rectangle on the canvas. Syntax Following is the syntax for drawing filled rectangles on canvas − context.fillRect(x, y, width, height); Following is the syntax for drawing outlined rectangles ...
Read MoreHow to draw a quadratic curve on HTML5 Canvas?
The HTML5 element provides a powerful way to draw graphics, animations, and complex shapes using JavaScript. To draw smooth curved lines, HTML5 Canvas offers the quadraticCurveTo() method, which creates quadratic Bézier curves between points. A quadratic Bézier curve is defined by three points: a starting point, an ending point, and a control point that determines the curve's direction and curvature. The curve starts from the current path position, bends toward the control point, and ends at the specified endpoint. Syntax Following is the syntax for the quadraticCurveTo() method − context.quadraticCurveTo(cpx, cpy, x, y); ...
Read MoreHow to draw a hollow circle in SVG?
To draw a hollow circle in SVG, use the element with fill="none" and define the outline using stroke properties. This creates a circle with only a border and transparent interior. SVG stands for Scalable Vector Graphics and is a language for describing 2D-graphics and graphical applications in XML. The XML is then rendered by an SVG viewer, and most web browsers can display SVG just like they display PNG, GIF, and JPG images. Syntax Following is the syntax for drawing a hollow circle in SVG − Parameters The element ...
Read MoreHow can I display an image inside SVG circle in HTML5?
To display an image inside an SVG circle in HTML5, you use the element combined with a clipping path. The element defines the circular boundary, while the element displays the actual image content that gets clipped to the circle shape. Syntax Following is the basic syntax for creating a clipped circular image in SVG − ...
Read MoreHow to use small font in HTML?
To create small font text in HTML, use the CSS font-size property with the style attribute. Since HTML5 deprecated the tag, CSS is the modern standard for controlling font sizes. You can specify font size in various units like pixels (px), em, rem, or percentages. The inline style attribute overrides any global styles defined in external CSS files or within tags in the document head. Syntax Following is the syntax for setting small font using inline CSS − Content Where value can be specified in pixels (px), em units, rem units, ...
Read MoreHow to draw circle in HTML page?
To draw a circle in HTML page, use SVG, HTML5 Canvas, or CSS. The most common approach is using CSS with the border-radius property set to 50% on a square element. SVG provides more control for complex graphics, while Canvas allows dynamic drawing with JavaScript. Using CSS Border-Radius The simplest method to create a circle is using CSS. Set equal width and height on an element, then apply border-radius: 50% to make it perfectly circular. Example − Basic CSS Circle CSS Circle ...
Read More