Help:Wiki University Flexbox - Display Horizontal

<< Last Chapter Next Chapter >>

Browser placement To see how the elements can adapt to any devise using CCS3 Flexbox, we will use the following example as an illustration. Here are four color boxes with text. They are shown on this page as your browser would place them. Notice, by default, they are in a column. Main Page Research Help Wiki Help Get Involved

Placing objects in a row - display:flex

First illustration of the capabilities of Flexbox coding is the ease of being able to place these four colored boxes in a row.  Step one - We need to place these four boxes into a  tag container. Consider the div tag container as the parent and the boxes as the children of the parent.  Step two - We will next add the first Flexbox coding to the inline styling of the opening div tag to have the color boxes line in a row:   Main Page Research Help Wiki Help Get Involved   NOTICE that the boxes are now in a row with only two words of code.  NOTICE that the boxes are on the left end of the container  NOTICE that a red border is in place around the boxes so you can see the relationship between the boxes and their container.  NOTICE that the width of the boxes are controlled by the content in the boxes.  </ul> Here is the coding: <div style=" display:flex  "> Main Page Research Help Wiki Help Get Involved  <li style="font-size:1.2em"> NOTICE that the boxes are now in a row with only two words of code.</li> </ul>

<h2 style="font-size:2em; background-color:#fcefcf; padding:3px">Moving boxes around horizontally - justify-content:flex-end

What if we want to move the boxes to the right side of the horizontal space. Here is the next Flexbox attribute: flex-content:flex-end.

Main Page Research Help Wiki Help Get Involved  <li style="font-size:1.2em"> NOTICE that the boxes are now in a row but to the right edge of the page or container. </li> </ul> Here is the coding: <div style=" display:flex ; justify-content:flex-center  "> Main Page Research Help Wiki Help Get Involved

<h2 style="font-size:2em; background-color:#fcefcf; padding:3px">Moving boxes to the middle - justify-content:center

What if we want to move the boxes to the middle of the horizontal space. Here is the next Flexbox attribute: flex-content:center.

Main Page Research Help Wiki Help Get Involved  <li style="font-size:1.2em"> NOTICE that the boxes are now together in the middle of the contain or page.</li> </ul> Here is the coding: <div style=" display:flex; justify-content:center  "> Main Page Research Help Wiki Help Get Involved

<h2 style="font-size:2em; background-color:#fcefcf; padding:3px">Try these out

<div style="border-top:10px solid lightgreen; border-left:10px solid lightgreen; border-right:10px solid lightgreen; "> <div style="font-size:14pt; width:100%; height:30px; vertical-align:middle; background-color:lightgreen; ">Exercises Copy and paste these codes for broken links in your sandbox and see if you can fix them: <div style="width:160px; height:20px; padding-top:3px; padding-left:10px; background-color:orange; color:white; border:1px solid orange; border-radius:5px; ">Check your answers
 * 
 * [Missouri, United States Genealogy|Missouri]
 * &lt;a ref="https://en.wikipedia.org/wiki/Main_Page"&gt;Wikipedia&lt;/a&gt;
 * Missouri, United States GenealogyMissouri
 * [Wikipedia]
 * Missouri, United States Genealogy

<div style="border-top:10px solid lightgray; border-left:10px solid lightgray; border-right:10px solid lightgray; "> Quick Quiz
 * How can links be broken?
 * A. Too many brackets.
 * B. Not enough brackets.
 * C. Wrong kind of brackets.
 * D. No space in an external link between URL and name of link.
 * E. No pipe in an internal link between name of page and name of link.
 * F. Using the URL as the name of the link.
 * G. All of the above.

<div style="width:160px; height:20px; padding-top:3px; padding-left:10px; background-color:orange; color:white; border:1px solid orange; border-radius:5px; ">Check your answers << Last Chapter Next Chapter >>