How-to articles, tricks, and solutions about ELEMENT

How to Add a Class to a Given Element

Read the tutorial and learn the two suggested methods of creating a JavaScript function that will add a class to the <div> element and solve your problem.

How to Add Border to HTML Table

Learn how to create an HTML table, how to change HTML table border style using CSS. How to add border to<div>,<h2> &<p> elements. Practice with examples

How to Add Elements to an Empty Array in PHP

In this tutorial, we display and describe the most flexible ways to add elements to an empty array. Follow the steps and you will manage that easily.

How to Add Style to the Parent Element when Hovering a Child Element

It is possible to style the parent element when hovering a child element. In this snippet, we’re going to demonstrate and explain how to do this step by step.

How to Align Inline-Block Elements to the Top of Container

Read the snippet and find a solution to how to align inline-block elements to the top of the container. Also, see examples!

How to Break Line Without Using <br> Tag in CSS

There are a few ways to break a line without using a <br> tag. For that, we can use the white-space and display properties, as well as pseudo-elements.

How to Center a <div> on the Screen Using jQuery

Read the tutorial and learn the jQuery method of centering the <div> element on the screen. Get a code snippet to add your script for centering the element.

How to Center an Absolutely Positioned Element in a Div

Centering an absolutely positioned element can cause difficulties. Find out how to center an absolutely positioned element with known and unknown dimensions.

How to Center an Element with a Fixed Position

Sometimes, you may have difficulties trying to center an element having a position set to “fixed”. If you have faced it, read this snippet and find the solution.

How to Check If an Element Contains a Class in JavaScript

Read this tutorial and learn valuable information about the multiple methods that are used for checking if the element contains a class in JavaScript.

How to Clear Floats? What is Clearfix?

Learn 3 methods of clearing floats. Know the most modern ways and about the end of clearfix. See all with examples.

How to Count All the Array Elements with PHP

While working with arrays, it is commonly necessary to count all its elements. This snippet will discover two helpful functions that will help you do that.

How to Delete an Element from an Array in PHP

In this short tutorial, you will find the most proper solution to the commonly asked question by programmers: how to delete an element from an array.

How to Disable the Resizing of the <textarea> Element?

Use the CSS3 resize property with its "none" value to disable the resizing function of the textarea element. Learn the ways of only vertically or horizontally resizing, too.

How to Display the Hidden Element on Hovering Over Hyperlink or <a> Tag

Learn How to Display the Hidden Element on Hovering Over Hyperlink or <a> tag. With this article, you can learn how to show the hidden elements.

How to Get a Specific Number of Child Elements With CSS

The :nth-child() pseudo-class selects only the elements that are nth child elements. Read and see examples of getting a specific number of child elements.

How to Get the First Element of an Array in PHP

This snippet gives you an opportunity to learn how to get the first element of an array using PHP. You can choose among the provided functions.

How to Get the Height of an Element

In this tutorial, you can find out how to get the height of an element using jQuery. Use offsetHeight and clientHeight properties and different jQuery methods.

How to Get the ID of the Element that Fired an Event in jQuery

This tutorial provides you the method of getting the id of the element fired an event in jQuery. Read about the event.target property and this keyword.

How to Get the Value of Text Input Field Using JavaScript

Read this tutorial and learn about several methods of getting the value of the input textbox value without wrapping the input element inside a form element.

How to Horizontally Center a <div> in Another <div>

The <div> tag is used to define parts of a page or a document. Learn How to Horizontally Center a <div> in Another <div> with W3docs tutorial.

How to Horizontally Center a Div with CSS

Sometimes you need to center your <div> horizontally but you don’t know-how. This tutorial is for you. It’s very easy if you follow the steps.

How to Insert an Element After Another Element in JavaScript

Read this JavaScript tutorial and learn useful information about modern approaches of inserting an element after another element using two easy methods.

How to Insert Video in HTML

See how to use <video> and <iframe> tags instead of the <embed>, <frame> and <object> tags. Learn how to set video autoplay. Practice with examples.

How to Loop Through Array and Remove Items Without Breaking the For Loop

Read this JavaScript tutorial and learn some useful information about the method of looping through an Array and removing items without breaking for loop.

1 2