Found 9326 Articles for Object Oriented Programming

How to layout table cells, rows, and columns with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 08:40:57

1K+ Views

In this tutorial, we will learn how to lay out table cells, rows, and columns with JavaScript. We can construct and edit DOM (Document Object Model) elements using JavaScript. There are two ways to add HTML components, such as tables, to an HTML document. The first is to include the HTML table tag directly into our HTML webpage, and the second is to create the full table within our JavaScript code. The second method is the most commonly used for building and adding tables to the DOM. The tr abbreviation refers to the table row. This reflects the complete table ... Read More

How to set the left padding of an element with JavaScript?

Anvi Jain
Updated on 23-Jun-2020 11:19:22

481 Views

Use the paddingLeft property in JavaScript to set the left padding. You can try to run the following code to return the left padding of an element with JavaScript −Example                    #box {             border: 2px solid #FF0000;             width: 150px;             height: 70px;          }                     This is demo text.             Left padding                function display() {             document.getElementById("box").style.paddingLeft = "100px";          }          

How to set the padding of an element with JavaScript?

Shubham Vora
Updated on 22-Nov-2022 07:02:33

4K+ Views

In this tutorial, we will look at the methods to set the padding of an element with JavaScript. All of us know that there are margins and padding available in JavaScript. Then, what exactly is the padding of an element? Padding can be termed as the space between an element's content and its border, whereas margin adds space around the edge. Use the padding property in JavaScript to set the padding of an element Let us check out the method to set the padding. Using the Style padding Property In this section, let us discuss the padding property. ... Read More

How to set the bottom padding of an element with JavaScript?

Abhinaya
Updated on 23-Jun-2020 11:21:20

512 Views

To set the bottom padding, use the paddingBottom property in JavaScript.ExampleYou can try to run the following code to return the bottom padding of an element with JavaScript −                    #box {             border: 2px solid #FF0000;             width: 150px;             height: 70px;          }                     This is demo text.                   Bottom padding                      function display() {             document.getElementById("box").style.paddingBottom = "100px";          }          

How to set the top position of an element with JavaScript?

Shubham Vora
Updated on 22-Nov-2022 07:40:45

11K+ Views

In this tutorial, we shall learn to set the top position of an element with JavaScript. To set the top position of an element, we can use the DOM Style top property in JavaScript. Alternatively, we can use the DOM Style setProperty() method. Let us discuss our topic in brief. Using the Style top Property We can set or return the top position of an element using the JavaScript DOM style top property. Following is the syntax to set the top position of an element using the Style top property with the dot notation or square brackets. Syntax object.style.top = ... Read More

How to set whether or not an element is resizable by the user with JavaScript?

Shubham Vora
Updated on 26-Oct-2022 12:20:50

323 Views

In this tutorial, we will learn to set whether or not an element is resizable by the user with JavaScript. Use the resize property to set whether the element is resizable by the user or not. The elements on a webpage are fixed on their position and size. But, sometimes, you need to give access to a user to increase the size or change the position of an element. The resize property of CSS gives us a way to change the size of an element. JavaScript DOM nearly provides all the styling properties provided by the CSS. We can even ... Read More

How to set the painting area of the background with JavaScript?

Shubham Vora
Updated on 22-Nov-2022 07:05:10

180 Views

In this tutorial, we will learn how to set the painting area of the background with JavaScript. The task is to define the background painting area. The background-clip property is commonly used to square measure the painting space of any web page's background. It specifies that we will modify the webpage's background regarding its contents or images/videos. The background-clip property specifies whether the background of an element extends beneath its border-box, padding box, or content box. If the element does not have a background image or color, this property has no visual effect unless the border has transparent or partially ... Read More

How to set the right position of a positioned element with JavaScript?

Shubham Vora
Updated on 25-Oct-2022 08:53:35

2K+ Views

In this tutorial, we shall learn to set the right position of a positioned element with JavaScript. What is a positioned element? The available position values in JavaScript are relative, absolute, fixed, or static. The static position is the default position value. Static elements are in the document order. A positioned element's position is based on its properties like the top, right, bottom, and left. We must set the position in every direction to align the elements as required. Here we are going to see the right position property. Let us get deeper into the topic and understand how to ... Read More

How to set the type of positioning method used for an element with JavaScript?

Shubham Vora
Updated on 25-Oct-2022 09:11:49

161 Views

In this tutorial, we shall learn to set the type of positioning method used for an element with JavaScript. The positioning permits us to move elements out of actual document order and make them appear in various ways. For instance, stay on top of one another or occupy the initial position within the browser viewport. Let us understand how to set the type of positioning method. Using the Style position Property With the Style "position" property, we can set or return the type of positioning method used for an element. The available position values are relative, absolute, fixed, sticky, and ... Read More

With JavaScript how to change the width of a table border?

Nitya Raut
Updated on 23-Jun-2020 10:58:32

748 Views

To change the width of a table border, use the DOM border property. You can try to run the following code to change the width of a table border in JavaScript −Example                    function borderFunc(x) {             document.getElementById(x).style.border = "5px dashed blue";          }                                             One             Two                                 Three             Four                                 Five             Six                                          

Advertisements