Found 10483 Articles for Web Development

How to set the height of an element with JavaScript?

Lakshmi Srinivas
Updated on 23-Jun-2020 13:06:43

767 Views

Use the height property to set the height of an element. You can try to run the following code to set the height of a button with JavaScript −ExampleLive Demo           Heading 1       This is Demo Text.       Update Height                function display() {             document.getElementById("myID").style.height = "100px";          }          

How to set the boldness of the font with JavaScript?

karthikeya Boyini
Updated on 23-Jun-2020 13:07:11

141 Views

Use the fontWeight property in JavaScript to set the font boldness.ExampleYou can try to run the following code to set the boldness of the font with JavaScript −Live Demo           Heading 1                This is Demo Text.             Set Font Family and Font Weight                function display() {             document.getElementById("myID").style.fontFamily = "verdana,sans-serif";             document.getElementById("myID").style.fontWeight = "800";          }          

How to set whether the style of the font is normal, italic or oblique with JavaScript?

Jai Janardhan
Updated on 23-Jun-2020 13:07:40

129 Views

To set the style of the font, use the fontStyle property. You can try to run the following code to set the style of the font to normal, italic or oblique with JavaScript −ExampleLive Demo           Heading 1                This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.             Set Font Family and Style                function display() {             document.getElementById("myID").style.fontFamily = "verdana,sans-serif";             document.getElementById("myID").style.fontStyle = "italic";          }          

How to set the font to be displayed in small capital letters with JavaScript?

Swarali Sree
Updated on 23-Jun-2020 12:56:31

202 Views

To set the font in small capital letters, use the fontVariant property.ExampleYou can try to run the following code to set the font to be displayed in small capital letters with JavaScript −Live Demo           Heading 1                This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.             Set Font Family and Font Variant                function display() {             document.getElementById("myID").style.fontFamily = "verdana,sans-serif";             document.getElementById("myID").style.fontVariant = "small-caps";          }          

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

Rishi Raj
Updated on 23-Jun-2020 12:31:43

1K+ Views

Use the left property to set the left position of a positioned element, such as a button.ExampleYou can try to run the following code to set the left position of a positioned element with JavaScript −Live Demo                    #myID {             position: absolute;          }                     Heading 1       This is Demo Text.       Change Left Position                function display() {             document.getElementById("myID").style.left = "150px";          }          

How to set the font size of text with JavaScript?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:21

911 Views

To set the font size, use the fontSize property in JavaScript. You can try to run the following code to set the font size of the text with JavaScript − Example Live Demo Heading 1 This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. Set Font Family and Size function display() { document.getElementById("myID").style.fontFamily = "verdana,sans-serif"; document.getElementById("myID").style.fontSize = "smaller"; }

How to set the horizontal alignment of an element with JavaScript?

Monica Mona
Updated on 23-Jun-2020 12:34:52

364 Views

To align the element horizontally, use the cssFloat property.ExampleYou can try to run the following code to set the horizontal alignment of an element with JavaScript −Live Demo                 This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.             Align Horizontally                function display() {             document.getElementById("myID").style.cssFloat = "right";          }          

How to set the brightness and contrast of an image with JavaScript?

Sharon Christine
Updated on 23-Jun-2020 12:36:37

4K+ Views

To set the brightness, use the brightness property and for contrast, use the contrast property.ExampleYou can try to run the following code to use image filters with JavaScript −Live Demo           Click below to change the brightness and contrast of the image.       Edit Image                      function display() {             document.getElementById("myID").style.filter = "brightness(50%)";             document.getElementById("myID").style.filter = "contrast(50%)";          }          

Set whether the flexible items should wrap or not with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:33:40

173 Views

In this tutorial, let us look at the way to set whether the flexible items should wrap or not with JavaScript. We can use the flex-wrap property in JavaScript to set the item wrap value. Let us look into this in brief. Using the Style flex-wrap Property The flex-wrap property defines whether to wrap the items within a container element. The items must be flexible for the flex-wrap property to work. The default value is nowrap. Users can follow the syntax below to use the flex-wrap property. Syntax object.style.flexWrap = "nowrap|wrap|wrap-reverse|initial|inherit" The syntax above sets the flex-wrap value to ... Read More

How to know whether the border and background of empty cells are hidden or not with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 08:36:28

229 Views

In this tutorial, we will learn how to know whether the border and background of empty cells are hidden or not with JavaScript. The JavaScript programming language can be used to create and modify DOM elements. There are two ways to incorporate HTML elements like tables into an HTML document. The first involves adding the HTML table tag straight to our HTML webpage, while the second involves writing the entire table as JavaScript code. The second approach is the most frequently used to create and include tables in the DOM. The tr abbreviation indicates the table row. This represents the ... Read More

Advertisements