{"id":148,"date":"2011-06-08T14:10:28","date_gmt":"2011-06-08T14:10:28","guid":{"rendered":"http:\/\/www.h-hennes.fr\/blog\/?p=148"},"modified":"2011-06-08T14:10:28","modified_gmt":"2011-06-08T14:10:28","slug":"truc-et-astuces-background-image-tr-chrome","status":"publish","type":"post","link":"https:\/\/www.h-hennes.fr\/blog\/2011\/06\/08\/truc-et-astuces-background-image-tr-chrome\/","title":{"rendered":"Truc et astuces : [Chrome] Contourner l&rsquo;erreur d&rsquo;affichage de la propri\u00e9t\u00e9 background-image sur un tr"},"content":{"rendered":"<p>Un petit tip que je partage avec vous aujourd&rsquo;hui car j&rsquo;ai pas mal cherch\u00e9 sur internet une solution qui me convenait.<\/p>\n<p>Le probl\u00e8me que j&rsquo;ai rencontr\u00e9 est le suivant :<br \/>\nSous Google Chrome et Safari, l&rsquo;image de fond attribu\u00e9e \u00e0 ma ligne de tableau &lt;tr&gt; ne s&rsquo;affichait pas correctement, et \u00e9tait reprise par chaque cellule du tableau.<\/p>\n<p><strong>Voici l\u2019aper\u00e7u probl\u00e9matique :<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" title=\"Erreur affichage background-image google chrome\" src=\"https:\/\/www.h-hennes.fr\/blog\/wp-content\/uploads\/2011\/06\/pb-fond-td-1.jpg\" alt=\"erreur affichage\" width=\"556\" height=\"271\" \/><\/p>\n<p><strong>Voici le code html du tableau<\/strong><\/p>\n<pre lang=\"HTML\">\r\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n<tbody>\r\n<tr class=\"bg_realisation_small\">\r\n<td class=\"bg_realisation_gauche_chrome\">\r\n<h3>AVANT<\/h3>\r\n<img decoding=\"async\" style=\"width: 260px; height: 195px;\" src=\"realisations-5.jpg\" alt=\"\" \/><\/td>\r\n<td class=\"bg_realisation_droite_chrome\">\r\n<h3>APRES<\/h3>\r\n<img decoding=\"async\" style=\"width: 260px; height: 195px;\" src=\"realisations-4.jpg\" alt=\"\" \/><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/pre>\n<p>Le principe du hack constiste \u00e0 supprimer le fond de la balise tr et \u00e0 l&rsquo;appliquer aux \u00e9l\u00e9ments td en sp\u00e9cifiant la position du fond.<\/p>\n<p><strong>Voici le Css du correctif :<\/strong><\/p>\n<pre lang=\"CSS\">tr.bg_realisation_small {\r\n\twidth:550px;\r\n\theight:290px;\r\n\tbackground-image:url('bg-nos-realisations-small.gif');\r\n\tbackground-repeat:no-repeat;\r\n}\r\n\/\/hack Safari\r\n@media screen and (-webkit-min-device-pixel-ratio:0) {\r\n\r\ntr.bg_realisation_small { background:none;}\r\ntr.bg_realisation_small .bg_realisation_gauche_chrome,\r\n tr.bg_realisation_small .bg_realisation_droite_chrome{\r\n background-image:url('bg-nos-realisations-small.gif');\r\n }\r\n.bg_realisation_gauche_chrome {\r\nbackground-repeat:no-repeat;\r\nbackground-position:top left;\r\n}\r\n.bg_realisation_droite_chrome {\r\nbackground-repeat:no-repeat;\r\nbackground-position:top right;\r\n}\r\n}<\/pre>\n<p>Une fois le hack appliqu\u00e9, le rendu est maintenant OK sous Chrome ! \ud83d\ude42<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Affichage background-image google chrome OK\" src=\"https:\/\/www.h-hennes.fr\/blog\/wp-content\/uploads\/2011\/06\/pb-fond-td-2.jpg\" alt=\"Affichage fond tr chrome corrig\u00e9\" width=\"564\" height=\"288\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un petit tip que je partage avec vous aujourd&rsquo;hui car j&rsquo;ai pas mal cherch\u00e9 sur internet une solution qui me convenait. Le probl\u00e8me que j&rsquo;ai rencontr\u00e9 est le suivant : Sous Google Chrome et Safari, l&rsquo;image de fond attribu\u00e9e \u00e0 ma ligne de tableau &lt;tr&gt; ne s&rsquo;affichait pas correctement, et \u00e9tait reprise par chaque cellule [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[120,118,58,59,119,122,121],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-trucs-et-astuces","tag-background-image","tag-chrome","tag-css","tag-html","tag-safari","tag-td","tag-tr"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":5,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h-hennes.fr\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}