Cutting-edge CSS Features

CSS Regions & CSS Shapes

Razvan Caliman / @razvancaliman

CSS Regions

illustration of content flowing from one region to another

illustration of complex layout with regions


  .content {
    /* collect content into a named flow */
    flow-into: myFlow;
  }

  .region {
    /* render the content from the named flow */
    flow-from: myFlow;
  }

Illustration of flows and regions
Demo of CSS Regions with viewport-height units. CSS Regions with viewport height units

Markup Separation


  <!-- content: semantic markup -->
  <article> 
    <h1>Title</h1>
    <p>...</p>    
  </article>

  <!-- layout: helper markup -->
  <div class="region"></div>
  <div class="region"></div>
  <div class="region"></div>  

Illustration of adaptive web app UI with CSS Regions Adaptive web app UI with CSS Regions

Aggregate content


  /* collect content from different places */
  header nav, 
  footer a {
    flow-into: menuFlow;
  }

  #menu {
    flow-from: menuFlow;
  }

Regions are only
Visual Containers

CSS Regions Status

W3C Working Draft - Adobe, Microsoft

Webkit browser logo
Chrome browser logo
Internet Explorer browser logo
Safari iOS7 logo

CSS Shapes

Shape Inside


  /* wrap the content inside a circle */
  #content { 
    shape-inside: circle(50%, 50%, 10em)
  }
  

Shape Outside


  #coffee {
    float: left;
    shape-outside: circle(50%, 50%, 10em);
  }

Complex shapes


  .content{
    /* shape defined by points of a polygon */
    shape-inside: polygon(x1, y1 x2, y2 ... );
  }
 
  .content{
    /* shape defined by the alpha levels of an image */
    shape-inside: url(image.png);
    shape-image-threshold: 0.5;
  }
  

CSS Shapes status

W3C Working Draft - Adobe, Microsoft

Webkit browser logo
Chrome browser logo
Chrome Canary browser logo

CSS Regions

illustration of content flowing from one region to another

CSS Shapes

html.adobe.com

end

@razvancaliman

Resources

Adobe Web Platform blog

CSS Regions

CSS Shapes

Credits