Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS Challenge

Featured Replies

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?

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 by evu

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.