{"id":2099,"date":"2020-09-10T10:15:59","date_gmt":"2020-09-10T08:15:59","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2099"},"modified":"2020-09-10T10:20:40","modified_gmt":"2020-09-10T08:20:40","slug":"center-divs-horizontally","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2099","title":{"rendered":"center divs horizontally"},"content":{"rendered":"\n<p>In my website I have three (main) divs: the actually main one and two small laterals ads divs (at left and at right of the main one). I noticed that the lateral divs weren&#8217;t at the middle of the free (lateral) space, in big screens.  <\/p>\n\n\n\n<p>1. The solution was use the flexbox, with this code in the parent div: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>display:flex; justify-content: space-around; <\/code><\/pre>\n\n\n\n<p>2. But a problem was the fact that these divs have a <code>position:fixed <\/code>propriety, that is incompatible with flex.<\/p>\n\n\n\n<p>Therfore I was <a href=\"https:\/\/stackoverflow.com\/questions\/63647712\/responsively-center-an-element-in-free-lateral-space\">suggested<\/a> to use <code>position:sticky<\/code> instead of <code>position:fixed<\/code>, and it worked.<\/p>\n\n\n\n<p>3.A last problem was that after this change, clicking anything in my page there was a sort od &#8220;dance&#8221; of all the element within the window. This was solved creating a <strong>parent<\/strong> div of my three (main) divs, so that not body, but this new div is the parent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my website I have three (main) divs: the actually main one and two small laterals ads divs (at left and at right of the main one). I noticed that the lateral divs weren&#8217;t at the middle of the free (lateral) space, in big screens. 1. The solution was use the flexbox, with this code &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=2099\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;center divs horizontally&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[566],"tags":[612,610,611,613],"class_list":["post-2099","post","type-post","status-publish","format-standard","hentry","category-webmaster","tag-center","tag-flex","tag-responsively-center","tag-sticky"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2099"}],"version-history":[{"count":7,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2099\/revisions"}],"predecessor-version":[{"id":2106,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2099\/revisions\/2106"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}