{"id":4874,"date":"2019-03-11T13:26:37","date_gmt":"2019-03-11T04:26:37","guid":{"rendered":"http:\/\/takuyakobayashi.jp\/?p=4874"},"modified":"2019-03-13T09:03:00","modified_gmt":"2019-03-13T00:03:00","slug":"object-fit%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%9b%e3%81%9aimg%e3%82%92background-sizecover%e3%81%ae%e3%82%88%e3%81%86%e3%81%ab%e8%a1%a8%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/takuyakobayashi.jp\/blog\/2019\/03\/11\/4874","title":{"rendered":"object-fit\u3092\u4f7f\u7528\u305b\u305aimg\u3092background-size:cover\u306e\u3088\u3046\u306b\u8868\u793a"},"content":{"rendered":"<p>IE\u306fobject-fit\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3001position\u3068transform\u306e\u3042\u308f\u305b\u6280\u3067img\u3092background-size:cover\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u305b\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><code>.object-fit {<br \/>\n  position: relative;<br \/>\n  width: 100%;<br \/>\n  height: 0;<br \/>\n  overflow: hidden;<br \/>\n  padding-top: 56.25%;<br \/>\n}<br \/>\n.object-fit img {<br \/>\n  position: absolute;<br \/>\n  top: 50%;<br \/>\n  left: 50%;<br \/>\n  max-width: none;<br \/>\n  min-width: 100%;<br \/>\n  min-height: 100%;<br \/>\n  width: auto;<br \/>\n  height: auto;<br \/>\n  transform: translate(-50%,-50%);<br \/>\n}<\/code><\/p>\n<style>\n.object-fit {\n  position: relative;\n  width: 100%;\n  height: 0;\n  overflow: hidden;\n  padding-top: 56.25%;\n}\n.object-fit img {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  max-width: none !important;\n  min-width: 100%;\n  min-height: 100%;\n  width: auto;\n  height: auto;\n  transform: translate(-50%,-50%);\n}<\/style>\n<p>img\u306e\u89aa\u8981\u7d20.object-fit\u306e\u9ad8\u3055\u3092height\u3067\u306f\u306a\u304fpadding-top\u3067\u6a2a\u5e45\u3068\u306e\u76f8\u5bfe\u3067\u53d6\u308b\u4e8b\u306b\u3088\u3063\u3066\u3001\u6bd4\u7387\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u4f38\u3073\u7e2e\u307f\u3057\u307e\u3059\u3002<br \/>\n16:9\u3067\u8868\u793a\u3057\u305f\u3044\u306e\u306a\u308956.25%<\/p>\n<div class=\"object-fit\"><img decoding=\"async\" src=\"https:\/\/takuyakobayashi.jp\/cms\/wp-content\/uploads\/2019\/03\/IMG_20190310_161015.jpg\" alt=\"\" \/><\/div>\n<p>1:1\u6b63\u65b9\u5f62\u306a\u3089100%\u3068\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<div class=\"object-fit\" style=\"padding-top:100%;\"><img decoding=\"async\" src=\"https:\/\/takuyakobayashi.jp\/cms\/wp-content\/uploads\/2019\/03\/IMG_20190310_161015.jpg\" alt=\"\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>IE\u306fobject-fit\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3001position\u3068transform\u306e\u3042\u308f\u305b\u6280\u3067img\u3092background-size:cover\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u305b\u3066\u307f\u307e\u3059\u3002 .object-fit { position &hellip; <a href=\"https:\/\/takuyakobayashi.jp\/blog\/2019\/03\/11\/4874\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">object-fit\u3092\u4f7f\u7528\u305b\u305aimg\u3092background-size:cover\u306e\u3088\u3046\u306b\u8868\u793a<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-4874","post","type-post","status-publish","format-standard","hentry","category-tips"],"_links":{"self":[{"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/posts\/4874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/comments?post=4874"}],"version-history":[{"count":0,"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/posts\/4874\/revisions"}],"wp:attachment":[{"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/media?parent=4874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/categories?post=4874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takuyakobayashi.jp\/blog\/wp-json\/wp\/v2\/tags?post=4874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}