achobaba — 2011-07-20T08:33:00-04:00 — #1
Hello everyone. First of all, I'd like to apologize in advance if I'm breaking any guidelines. My first time posting here and I hope I'm doing it right. I did check the pinned topics and I didn't find any information that could help me regarding my problem. =[
Anyways, here's my question in a more detailed form:
How do I go about using a custom image as borders for my divs? Am I right to assume that I'll be needing 3 images; with one each for the bottom and top to act as the corners, and another for the middle part that keeps repeating to scale itself depending on the amount of content it contains? If so, what is the proper way to do it?
Any relevant replies would be greatly appreciated. Thank you and good day !
ralphm — 2011-07-20T08:55:43-04:00 — #2
Hi achobaba. Welcome to SitePoint.
Nothing wrong with your question at all. As long as the div has a fixed width, the repeating image for the sides will be fine. However, you can only have one background image on the div, so the top and bottom borders may need to be contained in separate divs (unless you just have the images in the HTML, but that's not the best idea, as they are just presentational so are better served with CSS).
So, one way to do it is to have an extra div above and one below the main div, each with its won background image. Does that makes sense?
picnictutorials — 2011-07-20T10:04:09-04:00 — #3
paulob — 2011-07-20T12:04:14-04:00 — #4
[Another way to do it is to use a [URL="http://www.pmob.co.uk/temp/images/photobg.png"]single large image](http://www.pmob.co.uk/temp/ragged-photo.htm) in the html and scale it to fit. Results do depend on the type of the image used though and of course the extra image in the html is a bit of a pain but possibly less pain than multiple divs.
In css3 we can size background images with background-size to achieve a similar effect.
achobaba — 2011-07-20T16:14:09-04:00 — #5
Thank you so much sirs ! Your comments and links really made me understand it better. I'm going to try it out now. Again, thank you !