HTML Code:
<!DOCTYPE html><!-- Declares the document type and version of HTML -->
<html><!-- Begins the HTML document -->
<head><!-- Contains metadata and links to external resources -->
<title>How to set the direction of the flexible items inside the division element in reverse order</title><!-- Sets the title of the document -->
<style type="text/css"> /* Starts CSS styling */
#w3r { /* Targets an element with the id "w3r" */
width: 400px; /* Sets the width of the element to 400 pixels */
height: 400px; /* Sets the height of the element to 400 pixels */
border: 1px solid #c3c3c3; /* Sets a border around the element with color #c3c3c3 */
display: -webkit-flex; /* Sets the display property to flex for WebKit browsers */
-webkit-flex-direction: row-reverse; /* Sets the direction of the flexible items inside the element to row-reverse for WebKit browsers */
display: flex; /* Sets the display property to flex */
flex-direction: row-reverse; /* Sets the direction of the flexible items inside the element to row-reverse */
}
#w3r div { /* Targets the div elements inside the element with id "w3r" */
width: 60px; /* Sets the width of the div elements to 60 pixels */
height: 60px; /* Sets the height of the div elements to 60 pixels */
}
</style>
</head>
<body>
<p><strong>w3resource Tutorial</strong></p><!-- Paragraph element with strong (bold) text -->
<div id="w3r"><!-- Div element with id "w3r" -->
<div style="background-color:#00FF00;">HTML5</div><!-- Div element with background color and text "HTML5" -->
<div style="background-color:#3333FF;">CSS</div><!-- Div element with background color and text "CSS" -->
<div style="background-color:#FF6600;">PHP</div><!-- Div element with background color and text "PHP" -->
<div style="background-color:#FF3399;">SQL</div><!-- Div element with background color and text "SQL" -->
<div style="background-color:#FFCC33;">MYSQL</div><!-- Div element with background color and text "MYSQL" -->
</body>
</html><!-- Ends the HTML document -->
Explanation:
Live Demo:
See the Pen flex-direction-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4