Found 9053 Articles for Front End Technology

How to set the horizontal alignment of text with JavaScript?

Srinivas Gorla
Updated on 23-Jun-2020 11:28:55

621 Views

Use the textAlign property in JavaScript and set it to right for aligning it horizontally. You can try to run the following code to return the horizontal alignment of text with JavaScript −Example           This is demo text       Set Horizontal Alignment                function display() {             document.getElementById("myText").style.textAlign = "right";          }          

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

461 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 width of the top border with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 08:16:51

166 Views

In this tutorial, we will learn how to set the width of the top border with JavaScript. The border of an element is the outer part of the element. The border width for each side can be set with different JavaScript properties. For example, to set the width of the top border in JavaScript, use the borderTopWidth property. There are two approaches to specifying the width of the top border − Using the setProperty method Using the borderTopWidth property Using the setProperty method to set the width of the top border In JavaScript, any property of an element, ... Read More

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

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

480 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

10K+ 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 the color of the right border with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 11:18:47

221 Views

In this tutorial, we will learn how to set the color of the right border with JavaScript. To set the color of the right border in JavaScript, use the borderRightColor property. Set the color of the right border using this property. We can also apply the borderColor property to complete the task. The border is the outline of an HTML element. Border color can be set for different sides using different properties. To set the color of the right border with JavaScript, we have different ways − Using the style.borderRightColor Property Using the style.borderColor Property Using the style.borderRightColor ... Read More

How to set the type of quotation marks for embedded quotations with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 08:14:18

346 Views

In this tutorial, we will learn how to set the type of quotation marks for embedded quotations with JavaScript. The types of quotation marks can be changed using JavaScript. For example, if a sentence is in double quotes(“”), it can be modified to single quotes(‘’). To set the quotation, use the element. With that, add the type of quotation marks with the quotes property. Using the quotes property to set the type of quotation marks In JavaScript, the quotes property is used to set the type of quotation marks for embedded quotations. The quotation marks can be set using ... 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

301 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

Advertisements