Found 9053 Articles for Front End Technology

How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?

Srinivas Gorla
Updated on 23-Jun-2020 12:33:48

73 Views

Use the orphans property in JavaScript to set the minimum number of lines for an element that should be left at the bottom of a page when a page break occurs inside an element with JavaScript.You can return the orphans property like this −var res = object.style.orphansSet the orphans property like this −object.style.orphans = 'number|initial|inherit'The following are the property values shown above −number − Specify the minimum number of visible lines.Initial − Set property to its defaultInherit − Inherits property from the parent element

How to set the page-break behavior before an element with JavaScript?

Nancy Den
Updated on 23-Jun-2020 12:32:23

387 Views

Use the pageBreakBefore property in JavaScript to set the page-break behavior before an element. Use the always property to insert a page break before an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior before an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This if footer text.       Set page-break                      function display() {             document.getElementById("myFooter").style.pageBreakBefore = "always";          }          

How to set the page-break behavior inside an element with JavaScript?

Anvi Jain
Updated on 23-Jun-2020 12:35:33

2K+ Views

Use the pageBreakInside property in JavaScript to set the page-break behavior inside an element. Use the auto property to insert page break inside an element. Use auto or avoid property value to automatically insert page break inside an element, if needed, or avoid a page break, respectively.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior inside an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This ... Read More

How to set the page-break behavior after an element with JavaScript?

Nikitha N
Updated on 23-Jun-2020 12:36:09

577 Views

Use the pageBreakAfter property in JavaScript to set the page-break behavior after an element. Use the always property for page after an element.Note − The changes would be visible while printing or viewing the print preview.ExampleYou can try to run the following code to return the page-break behavior after an element with JavaScript −           Heading 1       This is demo text.       This is demo text.       This if footer text.       Set page-break                function display() {             document.getElementById("myFooter").style.pageBreakAfter = "always";          }          

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

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

88 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

Set how the item will shrink relative to the rest with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:30:43

199 Views

In this tutorial, let us look at the way to set how much the item will shrink relative to the rest of the elements in JavaScript. To set item shrink relative to the rest of the elements, we can utilize JavaScript's flexShrink property. Let's take a quick look at this. Using the Styel flexShrink Property The flexShrink property specifies how much a flex item will shrink according to the other items in the same container. The element must be flexible for the flexShrink property to function. The property's value functions as a ratio. For instance, 2:3 sets 2 to the ... Read More

Set how much the item will grow relative to the rest of JavaScript.

Priya Pallavi
Updated on 23-Jun-2020 12:20:37

42 Views

Use the flexGrow property to set how much the item will grow relative to the rest with JavaScript.ExampleYou can try to run the following code to learn how to work with flexGrow property −                    #box {             border: 1px solid #000000;             width: 250px;             height: 150px;             display: flex;             flex-flow: row wrap;          }          #box div {             flex-grow: 0;             flex-shrink: 1;             flex-basis: 20px;          }                              DIV1          DIV2          DIV3             Using flexGrow property       Set                function display() {             document.getElementById("myID").style.flexGrow = "2";          }          

How to make flexible items display in columns with JavaScript?

Smita Kapse
Updated on 23-Jun-2020 12:21:44

129 Views

Use the flexFlow property to set the flexible items to be visible in columns.ExampleYou can try to run the following code to make flexible items display in columns with JavaScript −                    #box {             border: 1px solid #000000;             width: 100px;             height: 150px;             display: flex;             flex-flow: row wrap;          }          #box div {             height: 40px;             width: 40px;          }                                  DIV1          DIV2          DIV3             Using flexDirection property       Set                function display() {             document.getElementById("box").style.flexFlow = "column nowrap";          }          

How to set the type of cursor to display for the mouse pointer with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 11:04:31

1K+ Views

In this tutorial, we will learn to set the type of cursor for the mouse pointer with JavaScript. To set the type of cursor, use the cursor property in JavaScript. It allows you to change the cursor on the button click. We can even change the type of cursor by using JavaScript. Different types of cursors have different meanings. There are many styles of cursors that can use on our webpage. Let us look at how to set the type of cursor to display for the mouse pointer with JavaScript. Using the Style cursor Property The cursor property is used ... Read More

How to set the direction of the flexible items with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 11:36:02

650 Views

In this tutorial, we will learn how to set the direction of the flexible items with JavaScript. The direction of the flexible items can be set using the flex-direction property of CSS. It defines how the flexible items will be placed in the flex container. Its default value is set to ‘row’, but it can have other values like ‘column’, ‘row-reverse’ etc. To set the direction of the flexible items with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Using the style.flexDirection Property Using the style.setProperty Method Using the style.flexDirection ... Read More

Advertisements