Semantic Grid: разметка будущегоКраковецкий АлександрSoftware Developer, PhD. Microsoft ASP.NET/IIS MVP, Regional Director@msugvnua
О чем поговорим?LESS: CSS preprocessorSemantic GridДемо
LESS: the dynamic stylesheet languageОсновные возможности:Переменные (variables)Функции (functions)Операторы (operations) Миксы(mixins) Вложенные правила (nested rules)
LESS: Variables// LESS @color: #4D926F; #header {color: @color; } h2 { color: @color; } /* Compiled CSS */ #header { color: #4D926F; } h2 { color: #4D926F; }
LESS: Mixins// LESS .rounded-corners (@radius: 5px) {    border-radius: @radius;    -webkit-border-radius: @radius; } #header { .rounded-corners; } #footer  { .rounded-corners(10px); }/* Compiled CSS */ #header { border-radius: 5px;  -webkit-border-radius: 5px; } #footer { border-radius: 10px; -webkit-border-radius: 10px; }
LESS: Nested Rules// LESS #header { h1 {font-size: 26px; font-weight: bold; } p { font-size: 12px; a {text-decoration: none; &:hover { border-width: 1px; }         }     } } /* Compiled CSS */ #header h1 	  { font-size: 26px; font-weight: bold; } #header p   { font-size: 12px; } #header p a 	  { text-decoration: none; } #header p a:hover { border-width: 1px; }
LESS: Functions & Operations// LESS @the-border: 1px; @base-color: #111; @red: #842210; #header { color: @base-color * 3; 	border-left: @the-border; 	border-right: @the-border * 2; }#footer {color: @base-color + #003300; border-color: desaturate(@red, 10%); } /* Compiled CSS */ #header { color: #333; border-left: 1px; border-right: 2px; } #footer  { color: #114411; border-color: #7d2717; }
LESS: настройка<link href="styles.less" rel="stylesheet" type="text/less“ /><script src="less.js" type="text/javascript"></script>Для .NET разработчиков:CSS Is Less plug-in: http://visualstudiogallery.msdn.microsoft.com/dd5635b0-3c70-484f-abcb-cbdcabaa9923В IIS нужно добавить “text/less” MIME type!
Semantic Grid@import 'grid.less'; Для фиксированной верстки (по умолчанию длина 960px):@column-width: 60; @gutter-width: 20; @columns: 12; Для гибкой верстки (процентной) нужно использовать переменную total-width:@total-width: 100%;
Semantic Grid: hello, world!<body> <article>Main</article> <section>Sidebar</section> </body>@import 'grid.less'; @columns: 12; @column-width: 60; @gutter-width: 20; article { .column(9); } section { .column(3); }
Semantic Grid: fluid layout@import 'grid.less'; @columns: 12; @column-width: 60; @gutter-width: 20; @total-width: 100%; // Switch from pixels to percentages article  { .column(9); } section { .column(3); }
Демо
Ссылкиhttp://lesscss.org/http://semantic.gs/http://msug.vn.ua/
Q&A?@msugvnua

Semantic Grid. Layout of the future

  • 1.
    Semantic Grid: разметкабудущегоКраковецкий АлександрSoftware Developer, PhD. Microsoft ASP.NET/IIS MVP, Regional Director@msugvnua
  • 2.
    О чем поговорим?LESS:CSS preprocessorSemantic GridДемо
  • 3.
    LESS: the dynamicstylesheet languageОсновные возможности:Переменные (variables)Функции (functions)Операторы (operations) Миксы(mixins) Вложенные правила (nested rules)
  • 4.
    LESS: Variables// LESS@color: #4D926F; #header {color: @color; } h2 { color: @color; } /* Compiled CSS */ #header { color: #4D926F; } h2 { color: #4D926F; }
  • 5.
    LESS: Mixins// LESS.rounded-corners (@radius: 5px) { border-radius: @radius; -webkit-border-radius: @radius; } #header { .rounded-corners; } #footer { .rounded-corners(10px); }/* Compiled CSS */ #header { border-radius: 5px; -webkit-border-radius: 5px; } #footer { border-radius: 10px; -webkit-border-radius: 10px; }
  • 6.
    LESS: Nested Rules//LESS #header { h1 {font-size: 26px; font-weight: bold; } p { font-size: 12px; a {text-decoration: none; &:hover { border-width: 1px; } } } } /* Compiled CSS */ #header h1 { font-size: 26px; font-weight: bold; } #header p { font-size: 12px; } #header p a { text-decoration: none; } #header p a:hover { border-width: 1px; }
  • 7.
    LESS: Functions &Operations// LESS @the-border: 1px; @base-color: #111; @red: #842210; #header { color: @base-color * 3; border-left: @the-border; border-right: @the-border * 2; }#footer {color: @base-color + #003300; border-color: desaturate(@red, 10%); } /* Compiled CSS */ #header { color: #333; border-left: 1px; border-right: 2px; } #footer { color: #114411; border-color: #7d2717; }
  • 8.
    LESS: настройка<link href="styles.less"rel="stylesheet" type="text/less“ /><script src="less.js" type="text/javascript"></script>Для .NET разработчиков:CSS Is Less plug-in: http://visualstudiogallery.msdn.microsoft.com/dd5635b0-3c70-484f-abcb-cbdcabaa9923В IIS нужно добавить “text/less” MIME type!
  • 9.
    Semantic Grid@import 'grid.less';Для фиксированной верстки (по умолчанию длина 960px):@column-width: 60; @gutter-width: 20; @columns: 12; Для гибкой верстки (процентной) нужно использовать переменную total-width:@total-width: 100%;
  • 10.
    Semantic Grid: hello,world!<body> <article>Main</article> <section>Sidebar</section> </body>@import 'grid.less'; @columns: 12; @column-width: 60; @gutter-width: 20; article { .column(9); } section { .column(3); }
  • 11.
    Semantic Grid: fluidlayout@import 'grid.less'; @columns: 12; @column-width: 60; @gutter-width: 20; @total-width: 100%; // Switch from pixels to percentages article { .column(9); } section { .column(3); }
  • 12.
  • 13.
  • 14.