{"id":302607,"date":"2020-04-27T21:00:08","date_gmt":"2020-04-27T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302607"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302607","title":{"rendered":"\u041c\u043e\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e CSS \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u0430\u043c\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499370\/\">\n<p>\u042f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e, \u0438 \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u0434\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043e CSS, \u0442\u043e \u043e\u043d\u0438 \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043a: &quot;\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430&quot;. \u041f\u043e\u0441\u043b\u0435 5 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043e\u0442\u043a\u0440\u043e\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043e CSS, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0437\u0430\u0434\u0430\u044e \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p><strong>\u04121. \u041a\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f \u043c\u043e\u0433\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 button, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 disabled?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 disabled, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. <\/p>\n<p>  <\/p>\n<pre><code class=\"css\">button[disabled] {   opacity: 0.24; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04122. \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 span, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u044f\u043c\u043e \u0437\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c input?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043c\u0435\u0436\u043d\u044b\u0439 (+).<\/p>\n<p>  <\/p>\n<pre><code class=\"css\">input + span {   opacity: 0.24; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04123. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 input, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442 type \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c &quot;radio&quot;?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 type=&quot;radio&quot; \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"css\">input[type=&quot;radio&quot;] {   opacity: 0.24; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04124. \u0415\u0441\u0442\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430. \u0421\u043a\u0430\u0436\u0438\u0442\u0435 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u0443\u0440\u043f\u0443\u0440\u043d\u044b\u043c \u0444\u043e\u043d\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;some-element&quot;&gt;some text&lt;\/div&gt; &lt;div class=&quot;some-element&quot;&gt;some text&lt;\/div&gt; &lt;article class=&quot;some-element&quot;&gt;some text&lt;\/article&gt;<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0441\u043b\u0443\u0447\u0430\u0439 1<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">.some-element:first-child {   background-color: purple; }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0441\u043b\u0443\u0447\u0430\u0439 2<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">.some-element:first-of-type {   background-color: purple; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2014 2.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04125. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441 :root?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>:root \u2014 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0434\u0435\u0440\u0435\u0432\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 HTML \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 html. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 SVG \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 svg.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04126. \u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441 :placeholder-shown?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441 :placeholder-shown \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 input \u0438\u043b\u0438 textarea \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f placeholder. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u0432\u043e\u0434 \u0442\u0435\u043a\u0441\u0442\u0430, \u0442\u043e placeholder \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441 :placeholder-shown \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"css\">input:placeholder-shown {   background-color: lightgray; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04127. \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u0437\u0430\u0434\u0430\u0442\u044c CSS \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0439\u0441\u044f \u0432 \u0444\u043e\u043a\u0443\u0441\u0435?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043b\u0430\u0441\u0441 :focus-within.<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;some-parent&quot;&gt;   &lt;button type=&quot;button&quot;&gt;Some button&lt;\/button&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.some-parent:focus-within {   outline: 2px solid purple;   outline-offset: 5px; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04128. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430\u0437\u043e\u0432\u0438\u0442\u0435 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0432\u0435\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c tbody:hover \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c opacity \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a. \u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0447\u0442\u043e\u0431\u044b opacity \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c :not(:hover).<\/p>\n<p>  <\/p>\n<pre><code class=\"css\">tbody:hover tr:not(:hover) {   opacity: 0.24; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u04129. \u041a\u0430\u043a \u044f \u043c\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 background-color \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 color?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">.link {   color: #222; }  .link::before {   background-color: #222; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e currentColor, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 color \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043e \u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .link.<\/p>\n<p>  <\/p>\n<pre><code class=\"css\">.link {   color: #222; }  .link::before {   background-color: currentColor; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041210. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f rem \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 font-size \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 html. \u041f\u0440\u0430\u0432\u0434\u0430 \u0438\u043b\u0438 \u043b\u043e\u0436\u044c?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041f\u0440\u0430\u0432\u0434\u0430.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041211. \u0423 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 button \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 16px \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 font-size. \u041a\u0430\u043a \u043c\u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 padding \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f em?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c 8px \u043d\u0430 16px. <\/p>\n<p>  <\/p>\n<pre><code class=\"css\">button {   font-size: 16px;   padding: .5em; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041212. \u042f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 10vw \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 padding-left. \u041a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 px, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u2014 480x320px?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f vw \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0442 \u0448\u0438\u0440\u0438\u043d\u0430 \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 10vw \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 10% \u043e\u0442 \u0448\u0438\u0440\u0438\u043d\u044b \u0432\u044c\u044e\u043f\u043e\u0440\u0442\u0430, \u0442.\u0435 \u043e\u0442 480px. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 10vw \u044d\u0442\u043e 48px. <\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041213. \u041a\u0430\u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b div \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div&gt;element 1&lt;\/div&gt;   &lt;div&gt;element 2&lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b div \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0434\u0440\u0443\u0433 \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u043c \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0443.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041214. \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 width \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u044d\u0442\u043e 1000px. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442? \u041f\u043e\u0447\u0435\u043c\u0443?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   width: 1000px; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0414\u0430. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e width \u0443 \u0431\u043b\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e width \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c width \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041215. \u041a\u0430\u043a \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 height \u0443 \u0431\u043b\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 height \u0443 \u0431\u043b\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0441\u043e\u0442\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041216. \u0421\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u0440\u0430\u0432\u0434\u0430 \u0438\u043b\u0438 \u043b\u043e\u0436\u044c?<\/strong><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041f\u0440\u0430\u0432\u0434\u0430.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041217. \u0420\u0430\u0437\u043c\u0435\u0440\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u2014 196x196px. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;span class=&quot;child&quot;&gt;element&lt;\/span&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.child {   width: 196px;   height: 196px; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 width \u0438 height \u0443 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041218. \u0411\u0443\u0434\u0435\u0442 \u043b\u0438 \u043e\u0442\u0441\u0442\u0443\u043f \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c .child \u0438 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043a\u043e\u0434\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.child {   margin-top: 10px; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0435\u0442, \u044d\u043b\u0435\u043c\u0435\u043d\u0442 .child \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0436\u0430\u0442 \u043a \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .parent, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e margin \u0434\u043b\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0445\u043b\u043e\u043f\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041219. \u041a\u0430\u043a\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 display \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043a\u043e\u0434\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">span {   display: inline-block;   position: absolute; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>block. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c position: absolute \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u043b\u043e\u0447\u043d\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 inline-block \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c block.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041220. \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 width \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u044d\u0442\u043e 1000px. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442? \u041f\u043e\u0447\u0435\u043c\u0443?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   width: 1000px; }  .child {   position: absolute; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0435\u0442. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 position: absolute \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e width \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041221. \u0427\u0435\u043c\u0443 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u0442\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .parent \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.child {   position: absolute; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e-\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u044e\u0442 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u0442\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .parent \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u044e.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041222. \u041a\u0430\u043a\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 span \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">span {   width: 300px;   height: 300px;   position: absolute; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>300x300px, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 span \u0431\u043b\u043e\u0447\u043d\u044b\u0439.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041223. \u042d\u043b\u0435\u043c\u0435\u043d\u0442 .child \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0434\u0432\u0438\u043d\u0443\u0442 \u043d\u0430 20px \u043e\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0438 \u043b\u0435\u0432\u043e\u0433\u043e \u043a\u0440\u0430\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .parent. \u041f\u0440\u0430\u0432\u0434\u0430 \u0438\u043b\u0438 \u043b\u043e\u0436\u044c?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   box-sizing: border-box;   width: 1000px;   padding: 20px; }  .child {   position: absolute; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041f\u0440\u0430\u0432\u0434\u0430. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c position: absolute \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u043e\u043d \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0434\u043e \u0442\u0435\u0445, \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u0435\u043c\u0443 \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0432\u043e\u0439\u0441\u0442\u0432 top, right, bottom, left. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u0431\u044b\u043b \u043e\u0442\u0441\u0442\u0443\u043f \u0432 20px \u043e\u0442 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0438 \u043b\u0435\u0432\u043e\u0433\u043e \u043a\u0440\u0430\u044f, \u0438 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 position: absolute \u044d\u0442\u043e\u0442 \u043e\u0442\u0441\u0442\u0443\u043f \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041224. \u041a\u0430\u043a\u043e\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 display \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043a\u043e\u0434\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">span {   display: inline-block;   position: relative; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>inline-block, \u0442.\u043a. \u043f\u0440\u0438 position: relative, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 display.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041225. \u041a\u0430\u043a\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 span \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"css\">span {   width: 300px;   height: 300px;   display: flex; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f display: flex, \u0442\u043e \u043e\u043d \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 width \u0438 height \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 span. \u0420\u0430\u0437\u043c\u0435\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u2014 300x300px.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041226. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 display \u0431\u0443\u0434\u0435\u0442 inline-block. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;parent&quot;&gt;   &lt;span class=&quot;child&quot;&gt;element2&lt;\/span&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   display: flex; }  .child {   display: inline-block; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041d\u0435\u0442. \u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u043b\u0435\u043a\u0441-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0431\u043b\u043e\u0447\u043d\u044b\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 block.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041227. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 width \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 .child \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;parent&quot;&gt;   &lt;div class=&quot;child&quot;&gt;element2&lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   display: flex; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0414\u0430.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041228. \u041a\u0430\u043a\u043e\u0439 \u043e\u0442\u0441\u0442\u0443\u043f \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;body&gt;   &lt;div class=&quot;parent&quot;&gt;     &lt;div class=&quot;first-child&quot;&gt;element 1&lt;\/div&gt;     &lt;div class=&quot;second-child&quot;&gt;element 2&lt;\/div&gt;   &lt;\/div&gt; &lt;\/body&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   display: flex;   flex-direction: column; }  .first-child {   margin-bottom: 20px; }  .second-child {   margin-top: 10px; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>30px, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u043b\u0435\u043a\u0441-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043d\u0435 \u0441\u0445\u043b\u043e\u043f\u044b\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041229. \u0413\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 .child \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0435\u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;parent&quot;&gt;   &lt;span class=&quot;child&quot;&gt;element2&lt;\/span&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   display: flex;   width: 250px;   height: 250px; }  .child {   width: 100px;   height: 100px;   margin-top: auto;   margin-left: auto; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u0412 \u043f\u0440\u0430\u0432\u043e\u043c \u043d\u0438\u0436\u043d\u0435\u043c \u0443\u0433\u043b\u0443 \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 150px.<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u041230. \u041a\u0430\u043a\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 span \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435?<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;div class=&quot;parent&quot;&gt;   &lt;span class=&quot;child&quot;&gt;element2&lt;\/span&gt; &lt;\/div&gt;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"css\">.parent {   display: flex; }  .child {   flex-basis: 250px;   width: 100px;   height: 200px;   min-width: 150px;   max-width: 225px; }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>225px. \u0423 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 flex-basis \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043f\u0435\u0440\u0435\u0434 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c width, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 min-width \u0438 max-width. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 250px (flex-basis) \u043d\u0435 \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0448\u0438\u0440\u0438\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f 225px.<\/p>\n<\/div><\/div>\n<\/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=\"https:\/\/habr.com\/ru\/post\/499370\/\"> https:\/\/habr.com\/ru\/post\/499370\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499370\/\">\n<p>\u042f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e, \u0438 \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u0434\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043e CSS, \u0442\u043e \u043e\u043d\u0438 \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043a: &quot;\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0446\u0435\u043d\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430&quot;. \u041f\u043e\u0441\u043b\u0435 5 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043e\u0442\u043a\u0440\u043e\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u043d\u0430\u0434\u043e\u0435\u043b\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043e CSS, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0437\u0430\u0434\u0430\u044e \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e.<\/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-302607","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302607","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=302607"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302607\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}