{"id":130,"date":"2022-11-21T21:59:04","date_gmt":"2022-11-21T21:59:04","guid":{"rendered":"http:\/\/javigomez.org\/?p=130"},"modified":"2025-09-29T20:34:30","modified_gmt":"2025-09-29T20:34:30","slug":"centrado-horizontal-y-vertical-con-flexbox","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2022\/11\/21\/centrado-horizontal-y-vertical-con-flexbox\/","title":{"rendered":"Centrado horizontal y vertical con Flexbox"},"content":{"rendered":"\n<p>Con un par de comandos CSS se puede centrar un texto o una imagen con Flex. Para centrar verticalmente se utiliza <em><strong>align-items<\/strong><\/em>, y para centrar horizontal <em><strong>justify-content<\/strong><\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=&quot;container&quot;&gt;\n    &lt;div class=&quot;centered-element&quot;&gt;\n      &lt;p&gt;Texto centrado&lt;\/p&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;\n&lt;div class=&quot;container&quot;&gt;\n    &lt;div class=&quot;centered-element&quot;&gt;\n      &lt;img src=&quot;https:\/\/javigomez.org\/ESIC\/munecos.png&quot; alt=&quot;centered&quot; \/&gt;\n    &lt;\/div&gt;\n&lt;\/div&gt;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>.container {\n    display: flex;\n  \/*centrado vertical*\/\n    <strong>align-items: center;<\/strong>\n  \/*centrado horizontal*\/\n    <strong>justify-content: center; <\/strong>\n    height: 150px;\n    border: 1px solid #006100;\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Con un par de comandos CSS se puede centrar un texto o una imagen con Flex. Para centrar verticalmente se utiliza align-items, y para centrar &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[26,71,106,153,208],"class_list":["post-130","post","type-post","status-publish","format-standard","hentry","category-css","tag-align-items","tag-centerado","tag-css","tag-flex","tag-justifiy-content"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":982,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/130\/revisions\/982"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}