{"id":161923,"date":"2012-12-09T02:28:03","date_gmt":"2012-12-08T22:28:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=161923"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=161923","title":{"rendered":"<span class=\"post_title\">\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 CSS-\u043a\u043b\u0430\u0441\u0441\u044b \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0442\u0440\u044e\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0432\u0435\u0440\u0441\u0442\u043a\u0443 \u043a\u043e\u043b\u043e\u043d\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u043c\u0438. <\/p>\n<p>  \u0421\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441\u0430\u00a0<strong>nth-of-type<\/strong>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 (<a href=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/columns\/\">\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/a>).<\/p>\n<h2>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 CSS-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/h2>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b\u00a0.first \u0438 .last \u0434\u043b\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u0432\u0435\u0440\u0441\u0442\u043a\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" title=\"first-and-last-class\" src=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/first-and-last-class.png\"\/><a name=\"habracut\"><\/a><\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u00a0nth-of-type<\/h2>\n<p>  \u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u00a0:nth-of-type(An+B) \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c float&#8217;\u044b \u0438 \u043e\u0442\u0441\u0442\u0443\u043f\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<ul>\n<li><strong>.grid4 .col:nth-of-type(4n+1)<\/strong>\u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u00a0.col \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/li>\n<li><strong>.grid2 .col:nth-of-type(2n+1)<\/strong>\u00a0\u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u00a0.col \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" title=\"nth-of-type-columns\" src=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/nth-of-type-columns.png\"\/><\/p>\n<pre><code class=\"css\">.grid4 .col:nth-of-type(4n+1), .grid3 .col:nth-of-type(3n+1), .grid2 .col:nth-of-type(2n+1) { \tmargin-left: 0; \tclear: left; } <\/code><\/pre>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u0442\u0430\u043b\u0430 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c media queries, \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445:<\/p>\n<pre><code class=\"css\">\/* col *\/ .col { \tbackground: #eee; \tfloat: left; \tmargin-left: 3.2%; \tmargin-bottom: 30px; }  \/* grid4 col *\/ .grid4 .col { \twidth: 22.6%; }  \/* grid3 col *\/ .grid3 .col { \twidth: 31.2%; }  \/* grid2 col *\/ .grid2 .col { \twidth: 48.4%; } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u043d\u0430 \u0442\u0440\u0435\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u043a\u043d\u0430 (\u043c\u0435\u043d\u0435\u0435 740px):  <\/p>\n<ul>\n<li>\u041c\u0435\u043d\u044f\u0435\u0442\u0441\u044f\u00a0.grid4 .col, \u0435\u0441\u043b\u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0435 31,2% (\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435\u0439 \u0448\u0438\u0440\u0438\u043d\u044b \u043e\u043a\u043d\u0430)<\/li>\n<li>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0435\u0432\u044b\u0439 \u043e\u0442\u0441\u0442\u0443\u043f<\/li>\n<li>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0435\u0432\u044b\u0439 \u043e\u0442\u0441\u0442\u0443\u043f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0nth-of-type(3n+1) \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" title=\"responsive-columns\" src=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/responsive-columns.png\"\/><\/p>\n<pre><code class=\"css\">@media screen and (max-width: 740px) { \t.grid4 .col { \t\twidth: 31.2%; \t} \t.grid4 .col:nth-of-type(4n+1) { \t\tmargin-left: 3.2%; \t\tclear: none; \t} \t.grid4 .col:nth-of-type(3n+1) { \t\tmargin-left: 0; \t\tclear: left; \t} } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u0441 \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0438 \u0442\u0440\u0435\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u043d\u0430 \u0434\u0432\u0443\u0445\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0448\u0438\u0440\u0438\u043d\u0435 \u043e\u043a\u043d\u0430 \u043c\u0435\u043d\u0435\u0435 600px:<\/p>\n<pre><code class=\"css\">@media screen and (max-width: 600px) { \t\/* change grid4 to 2-column *\/ \t.grid4 .col { \t\twidth: 48.4%; \t} \t.grid4 .col:nth-of-type(3n+1) { \t\tmargin-left: 3.2%; \t\tclear: none; \t} \t.grid4 .col:nth-of-type(2n+1) { \t\tmargin-left: 0; \t\tclear: left; \t}  \t\/* change grid3 to 2-column *\/ \t.grid3 .col { \t\twidth: 48.4%; \t} \t.grid3 .col:nth-of-type(3n+1) { \t\tmargin-left: 3.2%; \t\tclear: none; \t} \t.grid3 .col:nth-of-type(2n+1) { \t\tmargin-left: 0; \t\tclear: left; \t} } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u0432\u0441\u0435\u0439 \u0448\u0438\u0440\u0438\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"css\">@media screen and (max-width: 400px) { \t.col { \t\twidth: 100% !important; \t\tmargin-left: 0 !important; \t\tclear: none !important; \t} } <\/code><\/pre>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0432 Internet Explorer<\/h2>\n<p>  \u0412 Internet Explorer \u0432\u0435\u0440\u0441\u0438\u0438 8 \u0438 \u043c\u043b\u0430\u0434\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f\u00a0media queries \u0438 nth-of-type. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<a href=\"http:\/\/selectivizr.com\/\">selectivizr.js<\/a>\u00a0(\u0444\u0438\u043a\u0441\u00a0nth-of-type) \u0438\u00a0<a href=\"https:\/\/github.com\/scottjehl\/Respond\">respond.js<\/a>\u00a0(\u0444\u0438\u043a\u0441 media queries). \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e\u00a0selectivizr.js \u0438 respond.js \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435:\u00a0nth-of-type \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438\u00a0media queries.          \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/161923\/\"> http:\/\/habrahabr.ru\/post\/161923\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 CSS-\u043a\u043b\u0430\u0441\u0441\u044b \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0442\u0440\u044e\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0432\u0435\u0440\u0441\u0442\u043a\u0443 \u043a\u043e\u043b\u043e\u043d\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0445 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u043c\u0438. <\/p>\n<p>  \u0421\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441\u0430\u00a0<strong>nth-of-type<\/strong>: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0448\u0438\u0440\u0438\u043d\u0430 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 (<a href=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/columns\/\">\u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/a>).<\/p>\n<h2>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 CSS-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/h2>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b\u00a0.first \u0438 .last \u0434\u043b\u044f \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0438 \u0432\u0435\u0440\u0441\u0442\u043a\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" title=\"first-and-last-class\" src=\"http:\/\/koulikov.com\/wp-content\/uploads\/2012\/12\/first-and-last-class.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-161923","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161923"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161923\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}