cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!-- tell angular this is flexboxDemoApp -->
<html lang="en" ng-app="gridDemoApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Игровая площадка CSS Grid 1</title>
    <!-- Angulars Material CSS -->
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.css">
    <!-- include our compiled CSS -->
    <link href="css/style.css" rel="stylesheet">
  </head>
  <!-- this will be the only controller AppCtrl -->
  <body ng-controller="AppCtrl">
    <!-- Here's the main container -->
    <md-content class="md-padding">
      <div layout-gt-md="row" layout="column">
        <div flex-gt-md="66" flex="100" class="right-padding">

          <h3>Свойства родительского элемента &ndash; <span class="highlight">грид-контейнер</span></h3>
          
          <div layout="row">
          <div layout="column" layout-gt-md="column" class="code">
            <p>выравнивание по строчной оси (x):</p>
            <div layout="row">
              <div flex>
                <p>всей сетки</p>
                <strong>justify-content</strong>
                <md-radio-group ng-model="parent.justifyContent">
                  <md-radio-button value="stretch" class="highlight">stretch</md-radio-button>
                  <md-radio-button value="start">start</md-radio-button>
                  <md-radio-button value="end">end</md-radio-button>
                  <md-radio-button value="center">center</md-radio-button>
                  <md-radio-button value="space-between">space-between</md-radio-button>
                  <md-radio-button value="space-around">space-around</md-radio-button>
                  <md-radio-button value="space-evenly">space-evenly</md-radio-button>
                </md-radio-group>
              </div>

              <div flex>
                <p>элементов</p>
                <strong>justify-items</strong>
                <md-radio-group ng-model="parent.justifyItems">
                  <md-radio-button value="stretch" class="highlight">stretch</md-radio-button>
                  <md-radio-button value="start">start</md-radio-button>
                  <md-radio-button value="end">end</md-radio-button>
                  <md-radio-button value="center">center</md-radio-button>
                  <md-radio-button value="baseline">baseline</md-radio-button>
                </md-radio-group>
              </div>
            </div>
            <div layout="row">Интервал между колонками</div>
            <div layout="row" layout-align="center center" class="code">
              <div flex="60"><strong>grid-column-gap: {{parent.gridColumnGap}}px</strong></div>
              <md-slider flex min="0" max="50" ng-model="parent.gridColumnGap" aria-label="width"></md-slider>
            </div>
            <div layout="column">
              <p>Шаблон колонок:</p>
              <md-input-container  flex>
                <input type="text" ng-model="parent.gridTemplateColumns" flex>
              </md-input-container>
            </div>
          </div>
          <div layout="column" flex="10"></div>
          <div layout="column" layout-gt-md="column" class="code">

            <p>выравнивание по блочной оси (y):</p>
            <div layout="row">
              
              <div flex>
                <p>всей сетки</p>
                <strong>align-content</strong>
                <md-radio-group ng-model="parent.alignContent">
                  <md-radio-button value="stretch" class="highlight">stretch</md-radio-button>
                  <md-radio-button value="start">start</md-radio-button>
                  <md-radio-button value="end">end</md-radio-button>
                  <md-radio-button value="center">center</md-radio-button>
                  <md-radio-button value="space-between">space-between</md-radio-button>
                  <md-radio-button value="space-around">space-around</md-radio-button>
                  <md-radio-button value="space-evenly">space-evenly</md-radio-button>
                </md-radio-group>
              </div>

              <div flex>
                <p>элементов</p>
                <strong>align-items</strong>
                <md-radio-group ng-model="parent.alignItems">
                  <md-radio-button value="stretch" class="highlight">stretch</md-radio-button>
                  <md-radio-button value="start">start</md-radio-button>
                  <md-radio-button value="end">end</md-radio-button>
                  <md-radio-button value="center">center</md-radio-button>
                  <md-radio-button value="baseline">baseline</md-radio-button>
                </md-radio-group>
              </div>
            </div>
            <div layout="row">Интервал между рядами</div>
            <div layout="row" layout-align="center center" class="code">
              <div flex="60"><strong>grid-row-gap: {{parent.gridRowGap}}px</strong></div>
              <md-slider flex min="0" max="50" ng-model="parent.gridRowGap" aria-label="width"></md-slider>
            </div>
            <div layout="column">
              <p>Шаблон рядов:</p>
              <md-input-container>
                <input type="text" ng-model="parent.gridTemplateRows">
              </md-input-container>
            </div>

          </div>
          </div>

          <small>* Значения свойств по умолчанию <span class="highlight">подсвечены</span>.</small>

          <md-divider></md-divider>

          <h3>Свойства дочерних элементов &ndash; <span class="highlight">грид-элементы</span></h3>

          <div>
            <p>Свойства дочерних грид-элементов могут быть применены на дочернем уровне, раздельно для каждого элемента. Смотрите раздел с результатами и изменяйте какие-нибудь из их свойств. Наведите указатель мыши или коснитесь поля, чтобы увидеть название свойства.</p>
          </div>

          <md-divider hide show-sm show-md></md-divider>
        </div>

        <div flex>
          <h3 class="pull-left">Результат</h3>
          <p class="pull-right">
            <md-button class="md-accent md-raised" ng-click="addChild()">Добавить дочерний элемент</md-button>
          </p>

          <div class="clearfix"></div>

          <div
            class="grid-parent" 
            ng-attr-style="

              -webkit-justify-content: {{parent.justifyContent}};
              justify-content:         {{parent.justifyContent}};
                           
              -webkit-justify-items:   {{parent.justifyItems}};
              justify-items:           {{parent.justifyItems}};

              -webkit-align-items:     {{parent.alignItems}};
              align-items:             {{parent.alignItems}};

              -webkit-align-content:   {{parent.alignContent}};
              align-content:           {{parent.alignContent}};
                           
              -webkit-grid-column-gap: {{parent.gridColumnGap+'px'}};
              grid-column-gap:         {{parent.gridColumnGap+'px'}};

              -webkit-grid-row-gap:    {{parent.gridRowGap+'px'}};
              grid-row-gap:            {{parent.gridRowGap+'px'}};
                           
              -webkit-grid-template-columns:   {{parent.gridTemplateColumns}};
              grid-template-columns:   {{parent.gridTemplateColumns}};

              -webkit-grid-template-rows:      {{parent.gridTemplateRows}};
              grid-template-rows:      {{parent.gridTemplateRows}};
              "
          >
            <div 
              class="code md-whiteframe-z1"
              ng-repeat="child in children"
              ng-attr-style="

                -webkit-order:        {{child.order}};
                order:                {{child.order}};

                -webkit-justify-self: {{child.justifySelf}};
                justify-self:         {{child.justifySelf}};

                -webkit-align-self:   {{child.alignSelf}};
                align-self:           {{child.alignSelf}};
                             
                -webkit-grid-column-start:    {{child.gridColumnStart}};
                grid-column-start:    {{child.gridColumnStart}};

                -webkit-grid-column-end:      {{child.gridColumnEnd}};
                grid-column-end:      {{child.gridColumnEnd}};

                -webkit-grid-row-start:       {{child.gridRowStart}};
                grid-row-start:       {{child.gridRowStart}};

                -webkit-grid-row-end:         {{child.gridRowEnd}};
                grid-row-end:         {{child.gridRowEnd}};

              "
            >
              <div class="clearfix">
                <span class="child-number" aria-label="Number">{{$index + 1}}</span>
                <span class="remove-child pull-right" ng-click="removeChild($index)" title="Remove">
                  &#x2716;
                </span>
              </div>

              <div class="child-controls">
                <md-input-container>
                  <md-tooltip md-direction="top">order</md-tooltip>
                  <input type="number" ng-model="children[$index].order">
                </md-input-container>

                <md-input-container>
                  <md-tooltip md-direction="top">justify-self</md-tooltip>
                  <md-select ng-model="children[$index].justifySelf">
                    <md-option ng-value="value" ng-repeat="value in ['auto', 'start', 'end', 'center', 'stretch']">{{value}}</md-option>
                  </md-select>
                </md-input-container>

                <md-input-container>
                  <md-tooltip md-direction="top">align-self</md-tooltip>
                  <md-select ng-model="children[$index].alignSelf">
                    <md-option ng-value="value" ng-repeat="value in ['auto', 'start', 'end', 'center', 'baseline', 'stretch']">{{value}}</md-option>
                  </md-select>
                </md-input-container>
                
                <md-input-container>
                  <md-tooltip md-direction="top">grid-column-start</md-tooltip>
                  <input type="text" ng-model="children[$index].gridColumnStart">
                </md-input-container>                
                <md-input-container>
                  <md-tooltip md-direction="top">grid-column-end</md-tooltip>
                  <input type="text" ng-model="children[$index].gridColumnEnd">
                </md-input-container>                
                <md-input-container>
                  <md-tooltip md-direction="top">grid-row-start</md-tooltip>
                  <input type="text" ng-model="children[$index].gridRowStart">
                </md-input-container>                
                <md-input-container>
                  <md-tooltip md-direction="top">grid-row-end</md-tooltip>
                  <input type="text" ng-model="children[$index].gridRowEnd">
                </md-input-container>
              </div>
                
            </div>
          </div>
        </div>
      </div>
    </md-content>
    
    <!-- AngularJS -->
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.min.js"></script>

    <!-- Angular Material JavaScript -->
    <script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.js"></script>

    <!-- App.js -->
    <script src="js/app.js"></script>
  </body>
</html>

            
          
!
            
              @import "compass/css3";

@import "compass";

html, body {
  height: 100vh;
}

// Grid container
.grid-parent {
  display: grid;
  background: #169fe6;
  width: 100%;
  padding: 3px;
  min-height: 550px;
  height: 90vh;
  justify-content: start;
  grid-row-gap: 0;
  grid-column-gap: 0;
  grid-auto-columns: 10px;
  grid-auto-rows: 10px;
  

  // Grid items
  > div {
    display: inline-block;
    background: white;
    overflow: hidden;
    margin: 0;
    padding: 5px;

    .child-controls {
      margin-top: 7px;
    }
    
  }
}

.child-number {
  display: block;
  width: 22px;
  height: 22px;
  background: #169fe6;
  color: white;
  font-size: 14px;
  font-weight: bold;
  padding-top: 3px;
  text-align: center;
  @include border-radius(50%);
  float: left;
}

.code {
  font-family: Consolas, "Courier New", Monospace;
  font-size: 15px;
}

.remove-child {
  background: transparent;
  color: rgba(2,136,209,1);
  font-size: 14px;
  cursor: pointer;
}

.highlight {
  color: rgba(2,136,209,0.87);
}

.pull-left {
  float: left;
}

.pull-right {
  float: right;
}

.clearfix {
  &:after {
    content: '';
    display: block;
    clear: both;
  }
}

.right-padding {
  padding-right: 15px;
}

h3 {
  margin: 0 0 10px 0 !important;
}

p {
  margin: 0 0 10px 0 !important;
  line-height: 1.4em !important;
}

md-input-container {
  padding: 0 0 5px 0 !important;
  display: block;

  .md-input {
    padding: 0 !important;
    line-height: 1em !important;
  }
}

.child-controls md-input-container {

  max-width: 80px;
}

md-select {
  margin-top: 0 !important;

  .md-select-label {
    padding-top: 2px !important;
    padding-bottom: 4px !important;
  }
}

md-radio-button {
  margin: 5px 10px !important;
}

md-divider {
  margin: 10px 0 !important;
}

.nobottommargin {
  margin-bottom: 0 !important;
}

            
          
!
            
              // Declare the flexboxDemoApp module and its dependency 'ngMaterial'
var app = angular.module('gridDemoApp', ['ngMaterial']);
// Declare the AppCtrl controller
app
.config(['$mdThemingProvider', function ($mdThemingProvider) {
  $mdThemingProvider
    .theme('default')
    .accentPalette('light-blue', {
      default: '700'
    });
}])
.controller('AppCtrl', ['$scope', function ($scope) {
  $scope.parent = {
    justifyContent: 'stretch',
    justifyItems:   'stretch',
    alignContent:   'stretch',
    alignItems:     'stretch',
    gridColumnGap:  2,
    gridRowGap:     2,
    gridTemplateColumns: '100px auto 1fr',
    gridTemplateRows: 'auto 1fr'
  };

  $scope.children  = [];

  var addChild = function (order, justifySelf, alignSelf, gridColumnStart, gridColumnEnd, gridRowStart, gridRowEnd) {
    $scope.children.push({
      order:           order           || 0,
      justifySelf:     justifySelf     || 'auto',
      alignSelf:       alignSelf       || 'auto',
      gridColumnStart: gridColumnStart || 'auto',
      gridColumnEnd:   gridColumnEnd   || 'auto',
      gridRowStart:    gridRowStart    || 'auto',
      gridRowEnd:      gridRowEnd      || 'auto',
      
    });
  };
  var removeChild = function (index) {
    $scope.children.splice(index, 1);
  };

  $scope.addChild    = addChild;
  $scope.removeChild = removeChild;

  for (var i = 0; i < 5; i++) {
    addChild();
  }
    
}]);

            
          
!
999px
Loading ..................

Console