JavaScript style background color | HTML Example code

Use backgroundColor property in JavaScript to set a style background color of an HTML element.

Change style background color example HTML example code to change background color of elements using JavaScript. Change Webpage body color

Output: Change div tag color If you’re using a DIV container with a different background color you will Read More…


Replace text with image HTML | Example Using JavaScript

Use regular expression and innerHTML to Replace text with an image in HTML. A regular expression is based on the text want to replace. Example how to replace the text with image html HTML example code of Replace Text with Image using JavaScript (getElementsByClass or getElementsByID ). Steps: Use id for the text element Function Read More…


Center image in div vertically and horizontally | Example code

Center image in div vertically and horizontally use margin: auto; in CSS. In HTML webpage set left and right margin to auto and make it into a block element. Simple Example code: Image is in a same folder with webpage.

Output: Example of CSS center image in div Example code of CSS center image Read More…


Example div fill height | child div fill parent height

How to make the main content div fill the height of the screen with CSS? Let’s see one example, the webpage has divided into 3 parts:- A header, mainbody, and footer. We want the mainbody to fill 100% of the page (fill 100% in between footer and header). Here is code Stretch div using bottom Read More…


Horizontal align CSS | How to Horizontally center a

Horizontal align CSS To Center Align Elements in HTML (like), use CSS code margin: auto;. Try to set width of elements, it will prevent it from stretching out to the edges of its container. You can do align div, text, image elements by suing CSS. Horizontally Center Align Text To just center the text inside Read More…


CSS vertical-align div | Example for all browsers

CSS vertical align div Here is example code of How to vertically center <div> inside the parent element with CSS:- The best approach in modern browsers is to use flexbox, for other or older browsers you’ll need to implement a fallback solution.

Output: How to vertically center a div for all browsers? Below is Read More…


CSS text vertical-align | HTML Example code

There are many ways to Align text using CSS in HTML. You can align vertical text in <div> using simply CSS approaches, Someway are:- Before start you must know about CSS – What is CSS? Basic approach – For single line only Versatile approach – single line and multiple lines of text Simulating table display Read More…


Align div in center Using CSS | Code

Center div An absolutely positioned element acts the same for distribution of free space, and similarly can be centered vertically at the specified top and bottom. The trick of aligning div in the center: (The best and most flexible way example code).

Output: Note: only works if your element has a fixed height. How Read More…


mailto body line break | multiple lines example code

Use Encoding %0D%0A in mailto body to line break. This is the only valid way to generate a line break of content/text in the body. Use a single body parameter within the mailto string Use %0D%0A as newline Note: You cannot use HTML tags <br> in body of mailto. Example of mailto link with body Read More…


HTML mailto body formatting | Not possible to add style and code

HTML mailto body formatting The Mailto format does not support HTML code emails. Outlook was used at 2003, but to become compliant with the mailto: standard they removed that functionality. But you can Use %0D%0A for a line break in HTML body. See below example of it.

Output: After click send email link (default Read More…