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
Articles by Lokesh Badavath
Page 5 of 7
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 MoreHow to make an image responsive in HTML?
Responsive images automatically adjust to fit different screen sizes and device dimensions. This ensures that images scale appropriately on desktops, tablets, and mobile devices without breaking the layout or becoming too large or small to view properly. To make an image responsive in HTML, we use the tag combined with CSS properties that control the image's width and height behavior. The key is setting the width to scale with the container while maintaining the image's aspect ratio. Syntax Following are the main CSS properties used to make images responsive − width: 100%; height: auto; ...
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 create table header in HTML?
To create table headers in HTML, use the tag. Table headers are placed within table rows and define column or row headings. The element automatically displays text in bold and center-aligned by default, making it visually distinct from regular table data cells. Table headers serve multiple purposes − they provide semantic meaning for screen readers, can be styled differently with CSS, and help organize data in a structured format. Headers can be placed at the top of columns, beginning of rows, or both depending on your table structure. Syntax Following is the syntax to ...
Read MoreHow to set table width in HTML?
Setting table width in HTML controls how much horizontal space the table occupies on a web page. You can set table width using the inline style attribute with the width CSS property. The width can be specified in percentage (relative to parent container) or pixels (fixed width). Syntax Following is the syntax to set table width using inline styles − The width value can be specified as − Percentage − width: 50% (relative to container width) Pixels − width: 400px (fixed width) Keywords − width: 100% ...
Read MoreHow to mark inserted text in HTML?
In HTML, inserted text refers to content that has been added to a document. The tag is the semantic way to mark text as inserted, which browsers typically display with an underline to indicate the addition. The tag is particularly useful in document versioning, collaborative editing, and showing changes or updates to content. It provides semantic meaning that assistive technologies can understand, unlike purely visual styling approaches. Syntax Following is the syntax for the tag − The text to be inserted The tag supports optional attributes − ...
Read MoreHow to markup postal address in HTML?
A postal address is structured information used to identify the physical location of a building, apartment, or business. In HTML, we use the tag to mark up contact information, including postal addresses, for the author of a document or article. The element provides semantic meaning to contact information, making it accessible to screen readers and search engines. By default, browsers render address content in italic format and add line breaks before and after the element. Syntax Following is the syntax for the tag − Contact information goes here ...
Read MoreHow to set cell padding in HTML?
In HTML, cell padding refers to the space between the cell borders and the content inside table cells. We can set cell padding using CSS properties like padding applied through inline styles, internal stylesheets, or external CSS files. Cell padding improves table readability by providing breathing space around cell content. Syntax Following is the syntax to set cell padding in HTML using inline styles − Header Content Cell Content Following is the syntax using CSS selectors − th, td { padding: value; } The value can be ...
Read MoreHow to set cell width and height in HTML?
In HTML tables, cell width and height can be controlled using CSS styling. The most common approach is to use inline CSS with the style attribute on (table data) or (table header) elements. You can specify dimensions in pixels, percentages, or other CSS units. Syntax Following is the syntax for setting cell width and height using inline CSS − Content You can also apply dimensions to header cells − Header Here, value can be specified in pixels (px), percentages (%), em units, or other CSS measurement units. ...
Read MoreHow to merge table cells in HTML?
We use the colspan and rowspan attributes to merge cells in HTML tables. The rowspan attribute specifies the number of rows a cell should span vertically, whereas the colspan attribute specifies the number of columns a cell should span horizontally. These attributes should be placed inside the tag or tag to merge table cells and create more complex table layouts. Syntax Following is the syntax for the rowspan attribute to merge rows − cell data Following is the syntax for the colspan attribute to merge columns − cell data ...
Read More