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>

 

Series Navigation<< CSS3: Animated image zoom on mouse hover
CSS3: Flexbox and image alignment >>