cFlex Guide // Basic

cFlex License



unCommented rules in ./cflex3.css


Switch the Element-Width's

the examples below start swtiching at a width of 1024px

@media screen and (min-width:1024px) {

  /* Style */

}

lower than the 1024px-viewport, all elements are ruled to 100% width


On an element you can use flexbox by adding a the class .cflex and all inner elements will follow it.
You only have to choose what width you need and add those specific class to that child element


css: uncomment the classes cflex and cf_50

.cflex{
  display:flex;
  flex-flow: row wrap;
}

.cf_50{
  flex:1 1 50%;
  flex:1 1 calc( 100% / 2 );
}
html: add the class cflex to a div and cf_50 to the paragraph
<div class="cflex">
  <p class="cf_50">lorem ipsum …</p>
  <p class="cf_50">lorem ipsum …</p>
</div>

result

50%
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

50%
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.


html: add the classes cflex and cf_50 to two enclosing div's
<div class="cflex">
  <div class="cf_50">
    <p>lorem ipsum</p>
  </div>
  <div class="cf_50>
    <p>lorem ipsum</p>
  </div>
</div>

result

50%

50%


.cf_10{
  flex:1 1 10%;
  flex:1 1 calc( 100% / 10 );
}
.cf_90{
  flex:1 1 90%;
  flex:1 1 calc( 100% / 10 * 9 );
}

10%

90%


.cf_20{
  flex:1 1 20%;
  flex:1 1 calc( 100% / 5 );
}
.cf_80{
  flex:1 1 80%;
  flex:1 1 calc( 100% / 5 * 4 );
}

20%

80%


.cf_25{
  flex:1 1 25%;
  flex:1 1 calc( 100% / 4 );
}
.cf_75{
  flex:1 1 75%;
  flex:1 1 calc( 100% / 4 * 3 );
}

25%

75%


.cf_30{
  flex:1 1 30%;
  flex:1 1 calc( 100% / 10 * 3 );
}
.cf_70{
  flex:1 1 70%;
  flex:1 1 calc( 100% / 10 * 7 );
}

30%

70%


.cf_33{
  flex:1 1 33.3333%;
  flex:1 1 calc( 100% / 3 );
}
.cf_66{
  flex:1 1 66%;
  flex:1 1 calc( 100% / 3 * 2 );
}

33.3333%

66.6666%


.cf_40{
  flex:1 1 40%;
  flex:1 1 calc( 100% / 5 * 2 );
}
.cf_60{
  flex:1 1 60%;
  flex:1 1 calc( 100% / 5 * 3 );
}

40%

60%


.cf_50{
  flex:1 1 50%;
  flex:1 1 calc( 100% / 2 );
}

50%

50%


.cf_40{
  flex:1 1 40%;
  flex:1 1 calc( 100% / 5 * 2 );
}
.cf_60{
  flex:1 1 60%;
  flex:1 1 calc( 100% / 5 * 3 );
}

60%

40%


.cf_33{
  flex:1 1 33.3333%;
  flex:1 1 calc( 100% / 3 );
}
.cf_66{
  flex:1 1 66%;
  flex:1 1 calc( 100% / 3 * 2 );
}

66.6666%

33.3333%


.cf_30{
  flex:1 1 30%;
  flex:1 1 calc( 100% / 10 * 3 );
}
.cf_70{
  flex:1 1 70%;
  flex:1 1 calc( 100% / 10 * 7 );
}

70%

30%


.cf_25{
  flex:1 1 25%;
  flex:1 1 calc( 100% / 4 );
}
.cf_75{
  flex:1 1 75%;
  flex:1 1 calc( 100% / 4 * 3 );
}

75%

25%


.cf_20{
  flex:1 1 20%;
  flex:1 1 calc( 100% / 5 );
}
.cf_80{
  flex:1 1 80%;
  flex:1 1 calc( 100% / 5 * 4 );
}

80%

20%


.cf_10{
  flex:1 1 10%;
  flex:1 1 calc( 100% / 10 );
}
.cf_90{
  flex:1 1 90%;
  flex:1 1 calc( 100% / 10 * 9 );
}

90%

10%


no class needed ;-)

100%





.cf_20{
  flex:1 1 20%;
  flex:1 1 calc( 100% / 5 );
}

20%

20%

20%

20%

20%


.cf_25{
  flex:1 1 25%;
  flex:1 1 calc( 100% / 4 );
}

25%

25%

25%

25%


.cf_33{
  flex:1 1 33.3333%;
  flex:1 1 calc( 100% / 3 );
}

33.3333%

33.3333%

33.3333%


.cf_50{
  flex:1 1 50%;
  flex:1 1 calc( 100% / 2 );
}

50%

50%

based on font-size:16px;