{"id":2286,"date":"2017-03-06T23:28:34","date_gmt":"2017-03-06T23:28:34","guid":{"rendered":"http:\/\/cssreset.com\/?p=2286"},"modified":"2017-03-06T23:28:34","modified_gmt":"2017-03-06T23:28:34","slug":"css-snippets-folded-text-effect","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/css-snippets-folded-text-effect\/","title":{"rendered":"CSS Snippets: Folded Text Effect"},"content":{"rendered":"<p>Text effects are one of the most fun ways that you can play around with CSS to change the appearance of standard HTML tags. In this tutorial, we&#8217;ll demonstrate how to use the text shadow and transform properties to create a line of text that appears as though it&#8217;s been folded in half. Take a look at the snippet below, originally adapted from this <a href=\"http:\/\/codepen.io\/mandymichael\/pen\/BWyYYP\">CodePen<\/a> tutorial.<\/p>\n<p>To start, you&#8217;ll need some HTML. This part is very straightforward, all you really need are a div and an h1 tag:<\/p>\n<pre>&lt;div class=\"wrapper\"&gt;\r\n\u00a0 \u00a0 \u00a0&lt;h1 text-data=\"Folded\"&gt;Folded&lt;\/h1&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>Now it&#8217;s time to add the CSS to create that folded in half effect. Here&#8217;s how your CSS code should look:<\/p>\n<pre>@import url('https:\/\/fonts.googleapis.com\/css?family=Source+Sans+Pro');\r\nhtml, body {\r\n height: 100%;\r\n}\r\nbody {\r\n background: -webkit-linear-gradient(45deg, #e6e2df 80%, #c2c1bd 100%);\r\n background: linear-gradient(45deg, #e6e2df 80%, #c2c1bd 100%);\r\n}\r\n.wrapper {\r\n width: 100%;\r\n font-family: 'Source Sans Pro', monospace;\r\n margin: 0 auto;\r\n height: 100%;\r\n}\r\n.wrapper h1 {\r\n text-transform: uppercase;\r\n -webkit-transform: translate(-50%, -50%) skew(10deg) rotate(-10deg);\r\n transform: translate(-50%, -50%) skew(10deg) rotate(-10deg);\r\n font-size: 20vw;\r\n top: 50%;\r\n left: 50%;\r\n margin: 0;\r\n position: absolute;\r\n text-rendering: optimizeLegibility;\r\n font-weight: 900;\r\n color: rgba(227, 247, 240, 0.5);\r\n text-shadow: 1px 4px 6px #e6e2df, 0 0 0 #66303a, 1px 4px 6px #e6e2df;\r\n}\r\n.wrapper h1:before {\r\n content: attr(text-data);\r\n position: absolute;\r\n left: 0;\r\n top: -4.8%;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 50%;\r\n color: #fbf7f4;\r\n -webkit-transform: translate(1.6vw, 0) skew(-13deg) scale(1, 1.2);\r\n transform: translate(1.6vw, 0) skew(-13deg) scale(1, 1.2);\r\n z-index: 2;\r\n text-shadow: 2px -1px 6px rgba(0, 0, 0, 0.2);\r\n}\r\n.wrapper h1:after {\r\n content: attr(text-data);\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n overflow: hidden;\r\n width: 100%;\r\n height: 100%;\r\n z-index: 1;\r\n color: #d3cfcc;\r\n -webkit-transform: translate(0vw, 0) skew(13deg) scale(1, 0.8);\r\n transform: translate(0vw, 0) skew(13deg) scale(1, 0.8);\r\n -webkit-clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0% 100%);\r\n clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0% 100%);\r\n text-shadow: 2px -1px 6px rgba(0, 0, 0, 0.3);\r\n}<\/pre>\n<p>Now, your final product should look like this:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-2287 aligncenter\" alt=\"Screen Shot 2017-03-07 at 10.28.02 AM\" src=\"https:\/\/cssdeck.com\/blog\/\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-07-at-10.28.02-AM-1024x354.png\" width=\"1024\" height=\"354\" srcset=\"https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-07-at-10.28.02-AM-1024x354.png 1024w, https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-07-at-10.28.02-AM-300x103.png 300w, https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-07-at-10.28.02-AM-180x62.png 180w, https:\/\/cssdeck.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-07-at-10.28.02-AM.png 2018w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>As you can probably tell, we used the transform property a lot in this snippet, as well as the text-shadow property. By rotating our text and adding some shadows for dimension, the folded effect is fairly easily achieved. The CSS may need to be tweaked if you change the font family (different font faces have different sizes, etc), so make sure you include the @import rule at the top for the Source Sans Pro font family if you want to avoid having to do extra work on the code.<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Text effects are one of the most fun ways that you can play around with CSS to change the appearance of standard HTML tags. In this tutorial, we&#8217;ll demonstrate how to use the text shadow and transform properties to create [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/css-snippets-folded-text-effect\/\" title=\"Click to read 'CSS Snippets: Folded Text Effect'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":2287,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2286"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=2286"}],"version-history":[{"count":1,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2286\/revisions"}],"predecessor-version":[{"id":2288,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/2286\/revisions\/2288"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media\/2287"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=2286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=2286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=2286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}