CSS3: Putting an order to a flex box

This entry is part 13 of 13 in the series CSS3

If we want a particular flex box to be in the first order, we could use order:-1.

For example, in the example below, block D will be display as the first box.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Flexbox</title>
    <style>
        .flex-container {
            display: -webkit-flex;
            display: flex;
            width: 400px;
            height: 260px;
            background-color: gray;
            -webkit-flex-wrap: wrap;
            -moz-flex-wrap: wrap;
            flex-wrap: wrap;
        }

        .flex-item {
            background-color: Silver;
            width: 100px;
            height: 100px;
            margin: 10px;
        }

        .point0 {
            -webkit-order: -1;
            order: -1;
        }
    </style>
</head>
<body>
<div class='flex-container'>
    <div class='flex-item'>I am a content block A</div>
    <div class='flex-item'>I am a content block B</div>
    <div class='flex-item'>I am a content block C</div>
    <div class='flex-item point0'>I am a content block D</div>
    <div class='flex-item'>I am a content block E</div>
    <div class='flex-item'>I am a content block F</div>
</div>
</body>
</html>

CSS3: Flexbox and image alignment

This entry is part 8 of 13 in the series CSS3

We usually will have a block of text with an image besides the content.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Flexbox</title>
    <style>
        #flex-container {
            display: -webkit-flex;
            display: flex;
            width: 500px;
            height: 500px;
            background-color: gray;
        }

        #flex-item {
            background-color: Silver;
            width: 200px;
            height: 200px;
            margin: 10px;
        }
    </style>
</head>
<body>
<div id='flex-container'>
    <div id='flex-item'>I am content block A</div>
    <div id='flex-item'><img src='https://codecrawl.com/code/images/ushuaia.jpg' alt='Ushuaia' width='200px' height='200px'/></div>
</div>
</body>
</html>

CSS3: Flexbox and block content

This entry is part 7 of 13 in the series CSS3

Flexbox helps us to put our content into block form.

Flexbox consists of flex-container.  It also consists of flex-items, the children of flex-container.

The display property is set to flex or inline-flex. Inline-flex will put the content into inline block form.

<!DOCTYPE html>
<html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Flexbox</title>
    <style>
        #flex-container {
            display: -webkit-flex;
            display: flex;
            width: 500px;
            height: 500px;
            background-color: Navy;
        }

        #flex-item {
            background-color: Silver;
            width: 200px;
            height: 200px;
            margin: 20px;
        }
    </style>
</head>
<body>
<div id='flex-container'>
    <div id='flex-item'>I am content block A</div>
    <div id='flex-item'>I am content block B</div>
</div>
</body>
</html>