- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 8894 Articles for Front End Technology
86 Views
Use the orphans property in JavaScript to set the minimum number of lines for an element that must be visible at the top of a page. You can try to run the following code to learn how to implement orphans property −document.getElementById("p").style.orphansThis is how you can return the orphans property −var res = object.style.orphans;This is how to set the orphans property −object.style.orphans='number|initial|inherit'
138 Views
If you want to define a new or modify a property on an object, then use the Object.defineProperty in JavaScript. Use the property like the following −Object.defineProperty(obj, prop, descriptor)The following are the parameters −obj – Property is defined on this object. prop – Name of the property descriptor − The descriptor for the propertyExampleYou can try to run the following code to learn how to implement Object.defineProperty in JavaScript − const obj = {}; Object.defineProperty(obj, 'prop', { value: 20, writable: false }); obj.prop = 10; document.write(obj.prop);
82 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
408 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"; }
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
632 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"; }
98 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
211 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
51 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"; }
146 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"; }