{"id":17482,"date":"2013-06-25T21:01:47","date_gmt":"2013-06-25T13:01:47","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=17482"},"modified":"2024-09-03T18:18:12","modified_gmt":"2024-09-03T10:18:12","slug":"css3-content-wrapping","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/","title":{"rendered":"How to Wrap Content in Custom Shapes with CSS3"},"content":{"rendered":"<p><a href=\"https:\/\/www.hongkiat.com\/blog\/handpicked-printed-brochures\/\">Print media<\/a>, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in magazines on the web can be challenging due to the structured nature of web content.<\/p>\n<p>Fortunately, the CSS3 team is developing new capabilities to make this possible for web content using the <code>shape-inside<\/code> property.<\/p>\n<p>At present, this property is still in its early stages and, as of now, only works in Chrome (with a prefix). Additionally, some specifications are yet to be fully implemented.<\/p>\n<p>Let\u2019s explore how it works.<\/p>\n<h2>Using the shape-inside Property<\/h2>\n<p>The <code>shape-inside<\/code> property allows you to create four types of shapes: rectangle, circle, polygon, and ellipse. However, the only shape that appears to be functional at the moment is <code>polygon<\/code>. Below is an example of creating a triangle shape:<\/p>\n<pre>\r\n.basic-shape {\r\n  font-size: 12px;\r\n  width: 300px;\r\n  height: 300px;\r\n  overflow: hidden;\r\n  text-align: justify;\r\n  -webkit-hyphens: manual;\r\n  -webkit-shape-inside: polygon(0px 0px, 0 300px, 300px 300px);\r\n}\r\n<\/pre>\n<p>Here\u2019s the result:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg\" width=\"500\" height=\"300\" alt=\"Triangle shape example with CSS3 polygon property\"><\/figure>\n<p>If you want to wrap your content in a custom shape but are unsure how to define the coordinates, here\u2019s a simple method:<\/p>\n<p>First, <strong>create the shape in a vector editor<\/strong> such as Adobe Illustrator or Inkscape. Then, <strong>save it in SVG format<\/strong> and <strong>open it in a text editor<\/strong>.<\/p>\n<p>Locate the coordinates, <strong>assign a unit of measurement<\/strong> (px or %) to each, then copy and paste them as the polygon value. For example, here\u2019s how to create a hexagon:<\/p>\n<pre>\r\n.svg-shape {\r\n  -webkit-shape-inside: polygon(75.778px 272.829px, 1.555px 144.271px, 75.778px 15.713px, 224.222px 15.713px, 298.444px 144.271px, 224.222px 272.829px);\r\n} \r\n<\/pre>\n<p>And the result is:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/hexagon-shape.jpg\" width=\"500\" height=\"300\" alt=\"Hexagon shape example with CSS3 polygon property\"><\/figure>\n<p>It is technically possible to reference the SVG file directly to wrap content, but this functionality is not yet supported in current browsers.<\/p>\n<h2>Final Thoughts<\/h2>\n<p>While not every website will need to apply this property, these advancements hint at a more sophisticated future for web layouts. For more details, check out the following references:<\/p>\n<ul>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.w3.org\/TR\/css3-exclusions\/#shapes\">CSS3 Shapes<\/a> \u2013 W3C<\/li>\n<li><a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/blogs.adobe.com\/webplatform\/2013\/04\/10\/css-regions-and-exclusions-on-mobile\/\">CSS Regions and Exclusions on Mobile<\/a> \u2013 Adobe<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in magazines on the web can be challenging due to the structured nature of web content. Fortunately, the CSS3 team is developing new capabilities to make this possible for web content using the shape-inside&hellip;<\/p>\n","protected":false},"author":113,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3392,352],"tags":[507,506,2016],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>UI Design: Wrapping Content In Shapes With CSS3<\/title>\n<meta name=\"description\" content=\"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Wrap Content in Custom Shapes with CSS3\" \/>\n<meta property=\"og:description\" content=\"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2013-06-25T13:01:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-03T10:18:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg\" \/>\n<meta name=\"author\" content=\"Thoriq Firdaus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@tfirdaus\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoriq Firdaus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/\"},\"author\":{\"name\":\"Thoriq Firdaus\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\"},\"headline\":\"How to Wrap Content in Custom Shapes with CSS3\",\"datePublished\":\"2013-06-25T13:01:47+00:00\",\"dateModified\":\"2024-09-03T10:18:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/\"},\"wordCount\":297,\"commentCount\":14,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css3-content-wrapping\\\/triangle-shape.jpg\",\"keywords\":[\"CSS\",\"HTML\",\"HTML5 \\\/ CSS3 Tutorials\"],\"articleSection\":[\"Coding\",\"Web Design\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/\",\"name\":\"UI Design: Wrapping Content In Shapes With CSS3\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css3-content-wrapping\\\/triangle-shape.jpg\",\"datePublished\":\"2013-06-25T13:01:47+00:00\",\"dateModified\":\"2024-09-03T10:18:12+00:00\",\"description\":\"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css3-content-wrapping\\\/triangle-shape.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/css3-content-wrapping\\\/triangle-shape.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/css3-content-wrapping\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Wrap Content in Custom Shapes with CSS3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/e7948c7a175d211496331e4b6ce55807\",\"name\":\"Thoriq Firdaus\",\"description\":\"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.\",\"sameAs\":[\"https:\\\/\\\/thoriq.com\",\"https:\\\/\\\/x.com\\\/tfirdaus\"],\"jobTitle\":\"Web Developer\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/thoriq\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"UI Design: Wrapping Content In Shapes With CSS3","description":"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/","og_locale":"en_US","og_type":"article","og_title":"How to Wrap Content in Custom Shapes with CSS3","og_description":"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in","og_url":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2013-06-25T13:01:47+00:00","article_modified_time":"2024-09-03T10:18:12+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg","type":"","width":"","height":""}],"author":"Thoriq Firdaus","twitter_card":"summary_large_image","twitter_creator":"@tfirdaus","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Thoriq Firdaus","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/"},"author":{"name":"Thoriq Firdaus","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807"},"headline":"How to Wrap Content in Custom Shapes with CSS3","datePublished":"2013-06-25T13:01:47+00:00","dateModified":"2024-09-03T10:18:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/"},"wordCount":297,"commentCount":14,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg","keywords":["CSS","HTML","HTML5 \/ CSS3 Tutorials"],"articleSection":["Coding","Web Design"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/","url":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/","name":"UI Design: Wrapping Content In Shapes With CSS3","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg","datePublished":"2013-06-25T13:01:47+00:00","dateModified":"2024-09-03T10:18:12+00:00","description":"Print media, compared to web media, offers greater flexibility in content layout and display. However, replicating those intricate shape frames used in","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/css3-content-wrapping\/triangle-shape.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/css3-content-wrapping\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Wrap Content in Custom Shapes with CSS3"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/e7948c7a175d211496331e4b6ce55807","name":"Thoriq Firdaus","description":"Thoriq is a writer for Hongkiat.com with a passion for web design and development. He is the author of Responsive Web Design by Examples, where he covered his best approaches in developing responsive websites quickly with a framework.","sameAs":["https:\/\/thoriq.com","https:\/\/x.com\/tfirdaus"],"jobTitle":"Web Developer","url":"https:\/\/www.hongkiat.com\/blog\/author\/thoriq\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-4xY","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/17482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/113"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=17482"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/17482\/revisions"}],"predecessor-version":[{"id":72726,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/17482\/revisions\/72726"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=17482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=17482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=17482"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=17482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}