August 2, 201214 yr I've got a fun little challenge for everyone here. Those who frequent the IRC will know that I've been playing with slanted headings. These have now evolved into wrap-around headings; currently they look like this fiddle: Skateside's awesome fiddle. Here's the challenge: can anyone think of a way to make the slant stretch to the full height when that heading double-lines? The only rule is that you're not allowed to add any more elements (except a rogue <br> for testing). It should degrade in older browsers (I won't insist that it has to work perfectly in IE7, although you'll be hailed as a CSS god if you can pull it off). The background of the <body> tag can change or even be patterned, the background of the <article> will always be a solid colour (although if you can successfully render this on any background, more CSS god-like recognition will be heading your way) Nothing to win here except bragging rights. Wanna play?
August 3, 201214 yr Nailed it. Edit: second thoughts, no I haven't; It kills the :before. More thought needed. Edited August 3, 201214 yr by Renaissance-Design
August 3, 201214 yr http://jsfiddle.net/K5nFM/1/ This? ~evu. eD: To get it working in IE7 you'll need something like http://ie7-js.googlecode.com/svn/test/index.html Edited August 3, 201214 yr by evu
August 3, 201214 yr Just increase the width If you want to do it dynamically (up to a certain degree, naturally) you could use jquery to count the characters in h1 and adjust it accordingly. eD: Like this ~evu. eD: You might also be able to use simple tiled background too for some browsers http://css-tricks.co...g-border-image/ Edited August 3, 201214 yr by evu
August 3, 201214 yr Just increase the width Have to be careful with that... Simple but effective. Now make it work with 3 lines - mwa ha ha ha ha Yeah, that's what I was aiming for but I fell foul of your :before Edited August 3, 201214 yr by Renaissance-Design
August 3, 201214 yr Author Sadly, 3.2em is very slightly too short in Firefox, we'd need 3.3 and it goes a little crazy when that's reduced back to a single line. Chris has the right idea, I'm certainly aiming for a pure CSS solution that's as dynamic as possible. He actually tried my first thought of a huge border size and overflow: hidden; but discovered, much like I did, that the :before vanishes. I've managed to find a pure CSS solution, but I wouldn't say I'm happy with it: Skateside's less than ideal attempt By making the :after a square with a background image of a white triangle alighed right-top, it's possible to create the dynamics that I wanted without it spilling over the text and keeping the :before visible. To keep it image free I created a PNG and ran it through an online base64 encoder. Of course, if the background ever changes to one of the other 65 million possibilities that CSS affords us, a new image would have to be created and re-encoded. After all that work, may as well just use an image. I'd like to think there's a CSS solution that's as easy to modify as the first example
Create an account or sign in to comment