How-to articles, tricks, and solutions about HTML

How to Calculate Text Width with JavaScript

Read this JavaScript tutorial and learn about the best method of calculating the text width. Read about the advantages of the method over other methods.

How to Calculate the Width of an Element with the CSS calc() Function

In this snippet, you’ll learn how to calculate the width of an element with the CSS calc() function. See examples, where we mix percentages and pixels.

How to Center a Background Image Inside a Div

In this tutorial, find out how you can center your background image within a <div> element. For that, use the CSS background and background-size properties.

How to Center a Button Both Horizontally and Vertically within a Div

In our snippet you can find some solutions to the problem of centering a button within a <div>. One of our solutions to the problem also includes using Flexbox.

How to Center a Text Inside the CSS :before Pseudo-Element

In this snippet, you will find out how it is possible to center a text within the CSS :before pseudo-element. Try an example and find its description to make it clear.

How to Center an Image with the CSS text-align Property

In this snippet, you can see a trick, which can help to center an <img> element with the CSS text-align property. Use a <div> and apply the style to it.

How to Center the Text in the HTML Table Row

In this snippet, we’ll demonstrate and explain examples of centering a text in the table row. For that purpose, you can use the CSS text-align property.

How to Change Selected Value of a Drop-Down List Using jQuery

In this tutorial, you will read and learn about jQuery methods that are used to change the selected value of a drop-down list via its text description.

How to Change the Color of an <hr> Element

The HTML <hr> element is a block-level element and creates a horizontal line. In this snippet, find out how to style a horizontal line by adding a color to it.

How to Change the Color of the First Word in a Text

In this tutorial, you can see how to change the color of the first word of a text. For that, use the CSS :before pseudo-element with the content property.

How to Change the Image Source Using jQuery

Read this tutorial which will provide you with useful information about the best and easy method that can be used to change the image source using jQuery.

How to Change the Style of the "title" Attribute Within an Anchor Tag

Since actually, we cannot style the “title” attribute inside an anchor tag, we suggest using some other methods of styling the tooltip inside an anchor tag.

How to Check a Radio Button with jQuery

Read the tutorial and learn the right way of checking a radio button with jQuery. Also, read how to handle with different versions of jQuery while checking.

How to Check a Webpage is Loaded Inside an iframe or into the Browser Window

Read this JavaScript tutorial and find a working code for checking whether the webpage is loaded inside an iFrame or directly into the browser window.

How to Check and Uncheck Checkbox with JavaScript and jQuery

In this tutorial, you will read and learn about several JavaScript and jQuery methods for checking and unchecking a checkbox. Choose the best one for you.

How to Click Through a div to its Underlying Elements

You don't know how to click through a div to its underlying elements, and this causes some problems for you? Read this snippet and solve this problem.

How to Control the Space Between Bullets and <li> Elements

In this snippet, you can find out how to control the space between bullets and <li> elements. You can use the HTML <span> element and the CSS left property.

How to Control the Width of the <label> Tag

Since the <label> tag is an inline element, using the width property won’t have any effect. Here you can find some methods of adding width to the <label> tag.

How to Copy the Text to the Clipboard with JavaScript

Copying the text to clipboard makes it easier using the web page, so users will definitely like this functionality. You can create it by the help of JavaScript and we’re here to help you.

How to Create a Glowing Border Around an Input Field

In this snippet, we’re going to demonstrate some examples of creating a glowing border around an input field. For that, you need to use some CSS properties.

How to Create a Hidden Div without a Line Break or Horizontal Space

In this snippet, we’re going to demonstrate how you can create a hidden <div> element without a line break or horizontal space. Use the CSS display property.

How to Create a List With Dashes in HTML

In this tutorial, find out how it is possible to style a list with dashes instead of bullet points. Use the :before pseudo-element with the content property.

How to Create a Multi-Line Text Input Field In HTML

In this snippet, we’ll demonstrate how to create a multi-line text input field in HTML. Read this tutorial and see how this can be done with the <textarea> tag.

How to Create a Multicolor Text with HTML and CSS

If you want to make your Web page more attractive using multicolor texts, read our snippet, find out 3 ways of creating ones and see examples.

How to Create a New DOM Element from HTML String

Read this JavaScript tutorial and find the method that is used for creating a new DOM element from an HTML string. Get the explanation and see examples.