How-to articles, tricks, and solutions about HTML

Add class="active" to active page using PHP

You can add the "active" class to the active page using PHP by comparing the current URL to the URL of the page you want to mark as active.

Ajax Upload image

To upload an image using Ajax, you can use the following steps:

Clearing content of text file using php

To clear the contents of a text file using PHP, you can use the file_put_contents() function.

Confirm button before running deleting routine from website

Yes, you can add a confirm button before running a delete routine on a website using PHP.

Converting <br /> into a new line for use in a text area

In PHP, you can use the nl2br() function to convert line breaks (\n or \r\n) to <br /> tags.

Form Validation Using JavaScript

Incorrect information leads to bad user interactions. So as to prevent this problem, read and learn how to validate forms with the help of JavaScript!

How can I select and upload multiple files with HTML and PHP, using HTTP POST?

You can use the following HTML code to create a form that allows users to select and upload multiple files.

How can I view/open a word document in my browser using with PHP or HTML

You can use the PHP function readfile() to read the contents of a Word document and then use the appropriate headers to prompt the browser to open or download the file.

How do I add PHP code/file to HTML(.html) files?

To add PHP code to an HTML file, you will need to use PHP tags.

How do I return a proper success/error message for JQuery .ajax() using PHP?

To return a proper success/error message for jQuery.ajax() using PHP, you can do the following:

How Not to Wrap the Contents of <p>, <div>, and <span> Elements

In this snippet, we want to demonstrate how you can make the contents of the <p>, <div>, and <span> elements not to wrap. Use the CSS white-space property.

How to Add a Background-Color for the Text Width Instead of the Entire Element Width

On this page, you will find how to set a background-color for the text width instead of the width of the entire element. Choose the appropriate method and try examples.

How to Add a Border Inside the Table

Read this snippet if you have faced the difficulty of setting a border inside the table. In this tutorial, we suggest two methods of overcoming this problem.

How to Add a Border-Bottom to the Table Row

In this tutorial, we want to demonstrate how you can add a border only to the bottom of the table row. Read and find out what CSS property you need for this.

How to Add a Circle Around a Number in CSS

Adding a circle around a number can be easily done with CSS. This can be done using the border-radius property. Read our snippet and find the solution.

How to Add a Fade out Text Effect with CSS

If you want to use beautiful effects for texts and make your Website more eye-catching, read our snippet, try examples and learn to create fade out text effect.

How to Add a Fixed Width Column with CSS Flexbox

On this page, you will find out how to add a fixed-width column with the help of CSS Flexbox. To achieve this, you need to use the flex or flex-basis property.

How to Add a Glass Background Effect to the Text

If you want to make your website eye-catching and creative read this snippet and learn to create a glass background effect for your text step by step.

How to Add a Mouseover Text with HTML

In this tutorial, find out how to create a mouseover text description without Javascript. Use the HTML <div> or <span> element with the “title” attribute.

How to Add a Text on the HTML5 <canvas> Element

In this tutorial, you’ll find out how to add text on the HTML5 <canvas> element. For that, you need Javascript. Use the fillText() and strokeText() methods.

How to Add a Vertical Line in HTML

In this snippet, we’ll show how to add a vertical line on the left and right sides, as well as how to center it and how to add a vertical line before a text.

How to Add an Anchor Link to Jump to a Specific Part of a Page

Learn how to create an anchor link to jump to a specific section of a page, and how to link to the anchor from another webpage. Also see how to style the jumping anchor link with examples.

How to Add an HTML Button that Acts Like a Link

There are several ways to place a clickable button on a webpage that will be linked to another page of your website. You can add inline onclick event to HTML button tag, or input tag.

How to Add an Onclick Effect with HTML and CSS

In this snippet, we’ll demonstrate how to add an onclick event in CSS. The best way of creating an onclick effect is using the well-known checkbox hack.

How to Add and Remove Multiple or Single Select Options using jQuery

Read this tutorial and learn how you can remove multiple options or a specific option in the select list using some interesting and useful jQuery methods.

1 2 3 4 5