{"id":160,"date":"2007-08-28T09:15:11","date_gmt":"2007-08-28T07:15:11","guid":{"rendered":"http:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem\/"},"modified":"2025-05-24T16:27:21","modified_gmt":"2025-05-24T14:27:21","slug":"ie-css-float-print-problem","status":"publish","type":"post","link":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem","title":{"rendered":"IE css float print problem"},"content":{"rendered":"<p>The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don&#8217;t explicitly specify width it just expands them to 100%.<\/p>\n<p>There are some posts on the network, but all of them suggest to not use floats when printing. However this was no good for me, cause I arranged my forms with css and no tables. The solution to fix the width of floats was also no good, since I have different internationalization and some text differ in length.<\/p>\n<p>So since I couldn&#8217;t find any css solution I had to make a simple JS hack.<\/p>\n<p>In turns out IE has two useful events &#8211; onbeforeprint and onafterprint.  So I just used those to go over all my floating elements and set the width before printing:<\/p>\n<pre>\/\/ We try to fix printing styles because IE is has problems\r\nif (OAT.Browser.isIE) {\r\n OAT.Event.attach(window,\"beforeprint\",function() {\r\n \tvar elm = IB.PageContent.getElementsByTagName('div');\r\n \tfor (var i=0;i&lt;elm.length;i++)\r\n \t\tif (OAT.Dom.isClass(elm[i],'right') || OAT.Dom.isClass(elm[i],'left')) {\r\n \t\t\tvar size = OAT.Dom.getWH(elm[i]);\r\n \t\t\telm[i].style.width = size[0] + 'px';\r\n \t\t}\r\n \t}\r\n });\r\n}<\/pre>\n<p>The example uses the OAT library, but you can guess what it does.<\/p>\n<p>This fix works fine with the little exception that the divs move a little before print, but I can live with this for now.<\/p>\n<div id=\"facebook_like\"><iframe src=\"\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Flukav.com%2Fwordpress%2F2007%2F08%2F28%2Fie-css-float-print-problem&amp;layout=standard&amp;show_faces=true&amp;width=500&amp;action=like&amp;font=segoe+ui&amp;colorscheme=light&amp;height=80\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:500px; height:80px;\" allowTransparency=\"true\"><\/iframe><\/div>","protected":false},"excerpt":{"rendered":"<p>The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don&#8217;t explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[70,110,40],"tags":[],"class_list":["post-160","post","type-post","status-publish","format-standard","hentry","category-en","category-oat","category-tech"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don&#039;t explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"lukav\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Lukav&#039;s Weblog - So that what I know, you know too.\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"IE css float print problem - Lukav&#039;s Weblog\" \/>\n\t\t<meta property=\"og:description\" content=\"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don&#039;t explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2007-08-28T07:15:11+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2025-05-24T14:27:21+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"IE css float print problem - Lukav&#039;s Weblog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don&#039;t explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#blogposting\",\"name\":\"IE css float print problem - Lukav's Weblog\",\"headline\":\"IE css float print problem\",\"author\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/author\\\/lukav#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/#organization\"},\"datePublished\":\"2007-08-28T09:15:11+02:00\",\"dateModified\":\"2025-05-24T16:27:21+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#webpage\"},\"articleSection\":\"EN, OAT, Tech\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/lukav.com\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink#listItem\",\"name\":\"OpenLink\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink#listItem\",\"position\":2,\"name\":\"OpenLink\",\"item\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink\\\/oat#listItem\",\"name\":\"OAT\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink\\\/oat#listItem\",\"position\":3,\"name\":\"OAT\",\"item\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink\\\/oat\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#listItem\",\"name\":\"IE css float print problem\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink#listItem\",\"name\":\"OpenLink\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#listItem\",\"position\":4,\"name\":\"IE css float print problem\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/category\\\/openlink\\\/oat#listItem\",\"name\":\"OAT\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/#organization\",\"name\":\"Lukav's Weblog\",\"description\":\"So that what I know, you know too.\",\"url\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/author\\\/lukav#author\",\"url\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/author\\\/lukav\",\"name\":\"lukav\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/317f6418582595fc4849ac671d89398ab7579c22578d678d9774727e81490902?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"lukav\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#webpage\",\"url\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem\",\"name\":\"IE css float print problem - Lukav's Weblog\",\"description\":\"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don't explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/2007\\\/08\\\/28\\\/ie-css-float-print-problem#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/author\\\/lukav#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/author\\\/lukav#author\"},\"datePublished\":\"2007-08-28T09:15:11+02:00\",\"dateModified\":\"2025-05-24T16:27:21+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/\",\"name\":\"Lukav's Weblog\",\"description\":\"So that what I know, you know too.\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/lukav.com\\\/wordpress\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"IE css float print problem - Lukav's Weblog","description":"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don't explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use","canonical_url":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#blogposting","name":"IE css float print problem - Lukav's Weblog","headline":"IE css float print problem","author":{"@id":"https:\/\/lukav.com\/wordpress\/author\/lukav#author"},"publisher":{"@id":"https:\/\/lukav.com\/wordpress\/#organization"},"datePublished":"2007-08-28T09:15:11+02:00","dateModified":"2025-05-24T16:27:21+02:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#webpage"},"isPartOf":{"@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#webpage"},"articleSection":"EN, OAT, Tech"},{"@type":"BreadcrumbList","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/lukav.com\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink#listItem","name":"OpenLink"}},{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink#listItem","position":2,"name":"OpenLink","item":"https:\/\/lukav.com\/wordpress\/category\/openlink","nextItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat#listItem","name":"OAT"},"previousItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat#listItem","position":3,"name":"OAT","item":"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat","nextItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#listItem","name":"IE css float print problem"},"previousItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink#listItem","name":"OpenLink"}},{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#listItem","position":4,"name":"IE css float print problem","previousItem":{"@type":"ListItem","@id":"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat#listItem","name":"OAT"}}]},{"@type":"Organization","@id":"https:\/\/lukav.com\/wordpress\/#organization","name":"Lukav's Weblog","description":"So that what I know, you know too.","url":"https:\/\/lukav.com\/wordpress\/"},{"@type":"Person","@id":"https:\/\/lukav.com\/wordpress\/author\/lukav#author","url":"https:\/\/lukav.com\/wordpress\/author\/lukav","name":"lukav","image":{"@type":"ImageObject","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/317f6418582595fc4849ac671d89398ab7579c22578d678d9774727e81490902?s=96&d=mm&r=g","width":96,"height":96,"caption":"lukav"}},{"@type":"WebPage","@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#webpage","url":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem","name":"IE css float print problem - Lukav's Weblog","description":"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don't explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/lukav.com\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem#breadcrumblist"},"author":{"@id":"https:\/\/lukav.com\/wordpress\/author\/lukav#author"},"creator":{"@id":"https:\/\/lukav.com\/wordpress\/author\/lukav#author"},"datePublished":"2007-08-28T09:15:11+02:00","dateModified":"2025-05-24T16:27:21+02:00"},{"@type":"WebSite","@id":"https:\/\/lukav.com\/wordpress\/#website","url":"https:\/\/lukav.com\/wordpress\/","name":"Lukav's Weblog","description":"So that what I know, you know too.","inLanguage":"en-US","publisher":{"@id":"https:\/\/lukav.com\/wordpress\/#organization"}}]},"og:locale":"en_US","og:site_name":"Lukav's Weblog - So that what I know, you know too.","og:type":"article","og:title":"IE css float print problem - Lukav's Weblog","og:description":"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don't explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use","og:url":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem","article:published_time":"2007-08-28T07:15:11+00:00","article:modified_time":"2025-05-24T14:27:21+00:00","twitter:card":"summary_large_image","twitter:title":"IE css float print problem - Lukav's Weblog","twitter:description":"The latest discovery on IE problems was that when you use float divs and you decide to print, IE either ignore the floats or to be more precise, if you don't explicitly specify width it just expands them to 100%. There are some posts on the network, but all of them suggest to not use"},"aioseo_meta_data":{"post_id":"160","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-06-02 03:35:40","updated":"2025-06-03 23:54:23","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lukav.com\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lukav.com\/wordpress\/category\/openlink\" title=\"OpenLink\">OpenLink<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat\" title=\"OAT\">OAT<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tIE css float print problem\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/lukav.com\/wordpress"},{"label":"OpenLink","link":"https:\/\/lukav.com\/wordpress\/category\/openlink"},{"label":"OAT","link":"https:\/\/lukav.com\/wordpress\/category\/openlink\/oat"},{"label":"IE css float print problem","link":"https:\/\/lukav.com\/wordpress\/2007\/08\/28\/ie-css-float-print-problem"}],"_links":{"self":[{"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/posts\/160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":3,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":784,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/posts\/160\/revisions\/784"}],"wp:attachment":[{"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/media?parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/categories?post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lukav.com\/wordpress\/wp-json\/wp\/v2\/tags?post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}