How-to articles, tricks, and solutions about ELEMENT

How to Maintain the Aspect Ratio with CSS

Very often developers want to create a div element, that can change its width/height as the window width changes. That can be done by maintaining the aspect ratio of the element.

How to Make a Div a Clickable Link

On this page you can see how to make a <div> element a clickable link.

How to Make an HTML <div> Element not Larger Than its Content

How to Make a Div not Larger Than its Contents. Create <div> with the class "box". Place <h2> tag in the div and write some content in it. Fast solution!

How to Make the Cursor a Hand When Hovering Over a List Item

CSS suggests a variety of versions of a cursor. Learn how to create and make the cursor hand when the user hovers over a list item in different ways. See examples!

How to Override CSS Styles

How CSS overriding works, what is the cascading order and inheritance, what are the priorities and some tricks to override them.

How to Remove All the Child Elements of a DOM Node in JavaScript

Read this JavaScript tutorial and learn several simple and fast methods that are used for removing all the child elements of the DOM node with examples.

How to Remove the Space Between Inline-block Elements

Do not know how to remove space between the inline-block elements? Read the tutorial and find the easiest techniques for the solution to your problem.

How to Retrieve an HTML Element's Actual Width and Height

Read this tutorial and learn about the two methods that are used to retrieve an HTML element’s actual width and height. Find the best method for your case.

How to Scale the Content of <iframe> Element

Scaling the content of an <iframe> may be needed if you want to display an object in the area not matching its original size. Read and find possible solutions.

How to Select All Child Elements Except the Last One

Sometimes, you may need to select all the child elements except the last element. For that purpose, you can use the :not and :last-child pseudo- classes.

How to Select All Child Elements Recursively in CSS

Read our snippet and find out how to select all child element recursively in CSS. Use a child selector that matches all elements of a specified element.

How to Select the Last Element of a Specific Type

In this snippet, we want to display how you can select the last element of a specific type. For that, you need to use the CSS :last-of-type pseudo-class.

How to Select the Last Second Element with CSS

In this snippet, you’ll find out how to select the last second element with pure CSS. To achieve the goal, you need to use the CSS :nth-last-child() pseudo-class.

How to Set a Box-Shadow on One Side of the Element

To set a box shadow on one side of an element, use the box-shadow property. Read and find examples of adding box shadows outside and inside an element.

How to Set Background Color with HTML and CSS

Learn how to set a background color in general, how to have gradient and changing background colors with examples.

How to Set Space Between Flexbox Items

In this tutorial, we’ll show how you can easily set distance between flexbox items. For this, we’ll use the CSS justify-content property with two of its values.

How to Vertically Align Elements in a Div

On this page, you can find some methods allowing to vertically align elements in a <div>. Read and find the method depending on the specific situation.

How to Vertically Center Inline (Inline-Block) Elements

On this page, you’ll learn how to vertically align inline (inline-block) elements. Try examples with many different methods (CSS padding, vertical-align, etc.).

Removing an element from an Array in Java

There are a few different ways you can remove an element from an array in Java. Here are a few options:

1 2