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 116 of 151
How to create space between list bullets and text in HTML?
We can create space between list bullets and text in HTML using the CSS padding-left property. This property adds whitespace on the left side of each list item, pushing the text away from the bullet point while keeping the bullet in its original position. HTML supports both ordered lists using the tag and unordered lists using the tag. Individual list items are defined with the tag. By applying padding-left to the elements, we can control the spacing between bullets and text content. Syntax Following is the syntax to create space between list bullets ...
Read MoreExecute a script when the element is finished loading in HTML?
In HTML, executing a script when an element finishes loading is accomplished using the onload event. This event triggers when an element has completely loaded, including all its content, images, and external resources. The onload event is most commonly used with the element to run scripts after a web page has fully loaded. It can also be applied to individual elements like images, iframes, and objects. This functionality is useful for initialization tasks, form validation, cookie checking, or dynamically adjusting content based on the loaded page. Syntax Following is the syntax for the onload event attribute ...
Read MoreHow to create an ordered list with list items numbered with uppercase roman numbers in HTML?
An ordered list is a numbered list of items that allows you to control the sequence number and group related items in a structured format. HTML supports various types of ordered lists using the tag, with list items defined by the tag. The type attribute of the tag determines the numbering style. To create an ordered list with uppercase Roman numerals, we use type="I". This displays list items as I, II, III, IV, V, and so on. Syntax Following is the syntax to create an ordered list with uppercase Roman numerals − ...
Read MoreHTML DOM Anchor origin Property
The HTML DOM Anchor origin property returns a string containing the protocol, hostname, and port number of a URL. This is a read-only property that provides the origin portion of the anchor element's href attribute value. Syntax Following is the syntax for the Anchor origin property − anchorElement.origin Return Value The origin property returns a string representing the origin of the URL, which includes − Protocol − The scheme part (http:, https:, ftp:, etc.) Hostname − The domain name or IP address Port − The port number (if explicitly specified) ...
Read MoreHow to use external “.js” files in an HTML file?
External JavaScript files are .js files containing JavaScript code that can be linked to HTML documents using the tag with the src attribute. This approach separates JavaScript code from HTML markup, making code more organized, reusable, and maintainable. Syntax Following is the syntax to link an external JavaScript file to an HTML document − The src attribute specifies the path to the external JavaScript file. The path can be relative (within your project) or absolute (full URL to external resources). Creating an External JavaScript File An external JavaScript file is ...
Read MoreWhat is the difference between id and name attributes in HTML?
The id and name attributes in HTML serve different purposes. The id attribute uniquely identifies an element for CSS styling and JavaScript manipulation on the client side, while the name attribute identifies form data sent to the server as name-value pairs in the HTTP request. Syntax Following is the syntax for using the id attribute − Content Following is the syntax for using the name attribute − The id must be unique within the document, while the name can be shared across multiple elements (e.g., radio buttons in the ...
Read MoreWhat are valid values for the id attribute in HTML?
The ID attribute in HTML is a unique identifier for an element. It helps in identifying a specific area on a web page for CSS styling, JavaScript targeting, and anchor linking. Let us first see the common uses of the ID attribute in HTML − Script reference − In JavaScript, we use the ID attribute to select and manipulate a specific element on the page using methods like getElementById(). CSS selector − The ID is used as a selector with the # symbol to apply styles to a single specific element on the page. ...
Read MoreAre HTML comments inside script tags a best practice?
Before trying to understand whether HTML comments inside script tags is a best practice or not, let us first discuss how comments work in HTML and the different ways to use them. Comments are helpful for understanding code, leaving reminders, and providing explanations. They also help in disabling statements temporarily when testing or working on a new feature. The browser ignores everything inside a comment tag and does not render it on the page. HTML Comment Syntax Following is the basic syntax for writing an HTML comment − The comment starts with ...
Read MoreWhere should I put tags in HTML markup?
JavaScript code in HTML is placed between and tags. You can place them inside the , within the , or just before the closing tag. The recommended approach is placing scripts before so page content loads first. The tag tells the browser to interpret the content as a script. The type="text/javascript" attribute is optional in modern browsers as JavaScript is the default. Where to Place Tags In Loads before page renders In ...
Read MoreWhat is CDATA in HTML?
The full form of CDATA is Character Data. It is a section in XML used to include blocks of text that should be treated as raw character data, not as markup. The XML parser does not parse the content inside a CDATA section, so tags and entities within it are ignored. A CDATA section starts with and ends with the delimiter ]]>. Everything between these markers is treated as plain text. CDATA sections cannot be nested. In HTML, CDATA sections are not used − browsers treat them as comments and do not display them. CDATA is primarily ...
Read More