- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
How to set the order of the flexible item, relative to the rest with JavaScript?
To set the order of the flexible item, relative to the rest of JavaScript, use the order property. You can try to run the following code to implement order property −
Example
<!DOCTYPE html> <html> <head> <style> #box { border: 1px solid #000000; width: 420px; height: 150px; display: flex; } #box div { height: 80px; width: 80px; } </style> </head> <body> <div id = "box"> <div style = "background-color:orange;" ID ="myID1">DIV1</div> <div style = "background-color:blue;" id = "myID2">DIV2</div> <div style = "background-color:yellow;" id = "myID3">DIV3</div> </div> <button onclick = "display()">Set</button> <script> function display() { document.getElementById("myID1").style.order = "3"; document.getElementById("myID2").style.order = "1"; document.getElementById("myID3").style.order = "2"; } </script> </body> </html>
- Related Articles
- How to set the length of the item relative to the rest with JavaScript?
- Set how the item will shrink relative to the rest with JavaScript?
- Specify the order of a flexible item relative to the rest of the flex items inside the same container with CSS
- Set how much the item will grow relative to the rest of JavaScript.
- How to set the initial length of a flexible item with JavaScript?
- Set how much a flex item will grow relative to the rest of the flex items with CSS
- How to set the direction of the flexible items with JavaScript?
- Specify how much a flex item will shrink relative to the rest of the flex items with CSS
- How to set the position of the list-item marker with JavaScript?
- How to set the list-item marker type with JavaScript?
- How to set an image as the list-item marker with JavaScript?
- Set whether the flexible items should wrap or not with JavaScript?
- How to find the coordinates of the cursor relative to the screen with JavaScript?
- Move string capital letters to front maintaining the relative order - JavaScript
- How to set the alignment between the items inside a flexible container when the items do not use all available space with JavaScript?

Advertisements