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
Javascript Articles
Page 290 of 534
What are the essential tags for an HTML Document?
HTML (HyperText Markup Language) is the standard markup language for creating web pages and web applications. Understanding the essential HTML tags is crucial for building properly structured documents that browsers can interpret correctly. An HTML tag consists of three components: an opening tag that marks the start, content that displays in the browser, and a closing tag marked with a forward slash like . All HTML tags should be written in lowercase for best practices. Note: Some HTML tags are self-closing and don't require a closing tag, such as and . Every HTML document requires four ...
Read MoreHow to use the tag to define a relationship to an external resource?
The tag is used in HTML to define a relationship to an external resource. It is most commonly used to link external style sheets to HTML documents. The tag is placed inside the section and is a self-closing tag, meaning it does not require a closing tag. Syntax Key Attributes The tag uses several important attributes: rel - Specifies the relationship between the current document and the linked resource href - Specifies the URL of the external resource type - Specifies the media type of the linked resource ...
Read MoreSet the background color of an element with CSS
To set the background color of an element, use the background-color property in CSS. This property accepts color values in various formats including color names, hex codes, RGB, and HSL values. Syntax background-color: color-value; Example Here's how to set background colors using different methods: Background Color Example This text has a blue background color. ...
Read MoreHow to include inline JavaScript inside an HTML page?
In this tutorial, we will learn how to include inline JavaScript inside an HTML page. Inline JavaScript allows you to write JavaScript code directly within HTML event attributes, making it useful for simple interactions without external script files. Using Inline JavaScript to Show an Alert Message One of the simplest ways to understand inline JavaScript is by using the alert method. The alert method opens a pop-up window containing a message. Inline JavaScript code is written within event attributes and executes when that event is triggered. Syntax // inline JavaScript within the onclick attribute of ...
Read MoreHow to call a JavaScript function on a click event?
To call a function on click event in JavaScript, you can use either the addEventListener method or the onclick event attribute. The addEventListener method is a general way to attach an event handler to a DOM element, and it allows you to specify the event and the callback function to be called when the event occurs. The onclick attribute is a specific event attribute that allows you to specify a JavaScript function to be called when the element is clicked. Both methods allow you to specify a function to be called when the element is clicked, but the addEventListener ...
Read MoreHow to integrate Google AdSense into your webpage?
If your website has sufficient content and good page views, you can start adding advertisements to earn money. Google AdSense is a free and easy way to monetize your website by displaying targeted ads. Integrating Google AdSense involves both account setup and technical implementation. Let's explore the complete process. Setting Up Your AdSense Account Follow these steps to create and configure your AdSense account: Go to the official AdSense website and sign in with your Google Account. Set up your account with all required details including website ...
Read MoreSet the Background Image Position with CSS
To set the background image position, use the background-position property. This CSS property controls where the background image is positioned within its container element. Syntax background-position: horizontal vertical; The property accepts various values including pixels, percentages, and keywords like left, right, center, top, and bottom. Example: Positioning with Pixels This example sets the background image position 80 pixels from the left and centers it vertically: body { ...
Read MoreHow do we upload external file on a website using HTML forms?
If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is created using the element with the type attribute set to file. HTML File Upload Form Choose file... Browse No file chosen Basic File Upload Example Here's a simple HTML form with a file upload input: File ...
Read MoreHow to use the submit button in HTML forms?
Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc. Let's learn about how to use the submit button in HTML forms. It is created using HTML tag with the type attribute set to "submit". HTML Form with Submit Button ...
Read MoreHow to preselect a list item using JavaScript?
In this tutorial, we will learn how to preselect a select list item using JavaScript. This is useful when you want to set a default selection dynamically based on user preferences or application state. The HTML element creates dropdown menus where users can choose from multiple options. Each element represents a selectable choice. You can preselect options either by adding the selected attribute in HTML or programmatically using JavaScript. Understanding Select Elements A select element consists of: id attribute - Associates with labels for accessibility name attribute - ...
Read More