Found 10483 Articles for Web Development

How to add space around table border in HTML?

Lokesh Badavath
Updated on 18-Oct-2022 10:55:38

8K+ Views

We use the CSS property border-spacing, to set border spacing for an HTML table. It adds space around the table border between the adjacent cells in a table. We should specify the value in pixels for the border-spacing property to add. Syntax Following is the syntax for adding space around table border in HTML. border-spacing: 10px; Example 1 Given below is an example where we are creating a table and trying to add spaces around it. DOCTYPE html> ... Read More

How to center align text in table cells in HTML?

Lokesh Badavath
Updated on 31-Aug-2023 02:10:42

130K+ Views

We use the CSS property text-align, to center align text in table cells. We use inline, internal style sheet for text alignment in table cells. The text-align property of CSS sets the alignment of the content in and . By default, the content of are center-aligned and the content of are left-aligned. We can override the attribute by other to change the alignment. We can also change the align-value to left and right. Syntax Following is the syntax to center align text in tag of the table. Table header... Following is the syntax to center ... Read More

How to create a table with a caption?

Lokesh Badavath
Updated on 18-Oct-2022 10:52:20

845 Views

We use the tag, to create a table with caption in HTML. The caption tag will be inserted immediately after the tag. We can add only one caption for one table. By default, the alignment of this tag is center. We can change the alignment using CSS property called align. Syntax Following is the syntax of the caption tag of HTML Caption of the table... Example 1 In the following example we are creating a table with employee name and employee id with Employees as the caption. DOCTYPE html> ... Read More

How to find the largest number contained in a JavaScript array?

Abhishek
Updated on 31-Oct-2022 07:57:15

12K+ Views

In this tutorial, we will learn about the different methods or ways of finding the largest number contained inside a JavaScript array. An array is a collection of different values. We will define an array of numbers in which we will search for the largest number. There are three ways of finding the largest number in a JavaScript array that is listed below − Traversing the Whole Array Using the reduce() Method Using the Math.max() and apply() methods Traversing the Whole Array This is the easiest or the most naive approach to find the largest number in the ... Read More

How to determine if a number is odd or even in JavaScript?

Shubham Vora
Updated on 02-Sep-2023 15:30:06

44K+ Views

In this tutorial, let’s see how to determine whether a number is odd or even using JavaScript. The first step is understanding the logic. What are even numbers? Even numbers will be exactly divisible by 2. The remainder will be zero. What are odd numbers? Odd numbers will carry a remainder when divided by 2. Using the if-else Condition and Modulo Operator "if" will check a condition, and the if block code will be executed if the condition is true. If the condition is false, else block code will be executed. The modulo operator in JavaScript returns the remainder. Syntax ... Read More

How to round up a number in JavaScript?

Prabhdeep Singh
Updated on 07-Nov-2022 07:57:31

1K+ Views

In this tutorial, we will discuss how to round up a number in JavaScript. There is a property in JavaScript under ‘Math’ named “ceil” with the help of this property we can easily round up a number in JavaScript. Ceil() is a mathematical function that computes an integer x to greater than or equal to x. If x has the decimal value zero or is a simple integer then it returns x, and if the number is a decimal number (x.yz, here yz is a non-zero number) then it returns x+1. Syntax var x = A.B var value = Math.ceil(x); ... Read More

How do you check that a number is NaN in JavaScript?

Krantik Chavan
Updated on 17-Jun-2020 06:30:40

276 Views

NaN is a JavaScript property, which is Not-a-Number value. This shows it is not a legal number. Here’s the syntax −SyntaxNumber.NaNTo find out whether a number is NaN, use the Number.isNaN() or isNan() method. Here’s an example to check −ExampleLive Demo           Check                      function display() {             var a = "";             a = a + isNaN(434) + ": 434";             a = a + isNaN(-23.1) + ": -23.1";             a = a + isNaN('Hello') + ": 'Hello'";             a = a + isNaN(NaN) + ": NaN";             a = a + isNaN('') + ": ''";             a = a + isNaN(0) + ": 0";             a = a + isNaN(false) + ": false";             document.getElementById("test").innerHTML = a;          }          

How to create a collapsed border in HTML?

Lokesh Badavath
Updated on 18-Oct-2022 10:50:33

16K+ Views

We use border-collapse property to create a collapsed border in HTML. The border-collapse is a CSS property used to set the table borders should collapse into a single border or be separated with its own border in HTML. Border-collapse property has four values: separate, collapse, initial, inherit. With the value collapse If you pass collapse as a value of the border-collapse Property, the borders of the table are simply collapsed into a single border. Following is the syntax to create a collapsed border in HTML. border-collapse: collapse; Example 1 In the example given below we are trying to ... Read More

How to get a number of days in a specified month using JavaScript?

Nishtha Thakur
Updated on 17-Jun-2020 06:47:45

1K+ Views

To get numbers of days in a month, use the getDate() method and get the days.ExampleYou can try to run the following code to get a number of days in a month −Live Demo                 var days = function(month,year) {          return new Date(year, month, 0).getDate();       };       document.write("Days in July: "+days(7, 2012)); // July month       document.write("Days in September: "+days(9, 2012)); // September Month           OutputDays in July: 31 Days in September: 30

How to create table border in HTML?

Fendadis John
Updated on 10-Sep-2023 07:53:04

33K+ Views

To create table border in HTML, the border attribute was used. But the introduction of HTML5, deprecated the border tag. Create table border using the CSS property border. Set table border as well as border for and .ExampleYou can try to run the following code to create a border in the table in HTML. We’re using tag here:                    table, th, td {             border: 1px solid black;          }                     Employee Details                             Name             Amit             Sachin                                 Age             27             34                     Output

Advertisements