DIV with image borders - or alternative

greg's picture

He has: 1,581 posts

Joined: Nov 2005

I'm looking to jazz up some dynamic content containers for a site, which currently are only divs with background colour.
Problem is of course, it's a square coloured box, which is dull.

Let's say the page bg is white and the div bg is black.
What I want is to make the black div have shark fins / blade like things cutting into it here and there.

- See attached image as describing this is hard -

I thought of somehow using images for the div borders, but have no idea if that is cross-browser compatible. With image borders I can also make the corners rounded, I know there are methods for this, but if I could make the left/right borders images then I could have the shark fins and also rounded corners with images.

I have tried floating divs for this before and getting it to work in all browsers is a nightmare, mainly the annoyances with IE.

The images I can do, no issue, but what's the best way to apply this to a div. The content is dynamic, so the div needs to be able to grow height wise. Width is fixed px.

Or are DIV's not the best option?

AttachmentSize
div.png9.66 KB
pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

I think the best option here is to have two DIVs, one inside the other. Have one do the top-left corner, and the other do the bottom right corner, and have the backgrounds overflow to the maximum size you want.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.