Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1788
  • Last Modified:

CSS Grunge Borders

Hello Experts,

I'm trying to create an effect from the following link below for my navigation container and my container that will hold all my services. I don't know how to find such tutorials other than they look like grunge backgrounds.

Basically I will have a navigation container that will be 700px width and 60px height with a solid background color applied to it. Is there a way to add a background image to give the nav container a look like that? Same would apply for my services container (940px width and 600px height with a solid background color applied. I would need to somehow apply a background effect like the link below.

http://static.livedemo00.template-help.com/wt_42014/
0
asp_net2
Asked:
asp_net2
  • 3
  • 2
  • 2
1 Solution
 
COBOLdinosaurCommented:
I don't understand the problem.  The page is just a few images.  The "grunge" effect is part of the images.  It is done in any graphics program.  Just create the images and add them to the css as a background image.  

Cd&
0
 
asp_net2Author Commented:
The problem is that I want to apply that grunge effect to a container(s).

For example if I have a div named "services" and apply the properties below, then I would like to apply a grunge background to that without making the div look square block. Also when that div gets resized I would like the grunge effect to adapt.

Can you assist with this?

Width: 700px
Background-color: blue
0
 
COBOLdinosaurCommented:
The page you posted as an example is fixed and static and a single version, and that is the only way it will work.

You can create the background and if you put it in a fixed siz container on a static page it will work out.  The second resolution changes or a page element is re-sized the image background will re-position and possibly distort.  The only solution will be to use scripting on the page that might work  ost of the time and when it does not the page will be a mess.

So either go with a fixed, static layout; develop a large number of versions of the background for each resolution and browser you want to support; or start working out how much detailed scripting you are going to have to add to the page.

Cd&
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Alicia St RoseOwner & Principle Developer/DesignerCommented:
Hi asp_net2
This can be done with wrapper divs and a y-repeating tile.

You will have to create the graphic in Photoshop, then slice off the top and bottom as two images. Then for the middle part you can use the offset filter in photoshop to make a tile.

The top image goes into the wrapper div. Inside the wrapper div is your content div and an additional empty div for the bottom of the background image.
<div id="wrapper">
 <div id="content">
 </div>
 <div id="bottom"></div>
</div>

Open in new window


CSS:
#wrapper {
 padding: /*this should be as high as the top.png*/
 background: url('top.png') top center no-repeat;
}
#content {
 background: url('content-tile.png') top center repeat-y;
}
#bottom {
height: /*this should be as high as the bottom.png
background: url('bottom.png') bottom center no-repeat;
}

Open in new window

This will only shrink or grow with the content. If you need to resize as in responsive, then you are going to have to make separate batches of images for each device size, and add the new background images using CSS media queries...
0
 
asp_net2Author Commented:
@laughhearty,

Can you show me an example on how that will work?
0
 
Alicia St RoseOwner & Principle Developer/DesignerCommented:
Here's an example with perhaps a simpler way:

Another way to do this is with only two images and no tile. You'll have to create the top, but make it really long to accommodate any future lengthy text. Since this will be  larger image you'll have to use a jpg instead of a png and grab some of the body background.

You'll still have the wrapper, but put the empty div for the bottom outside the wrapper.

Option 2:
<div id="wrapper">
 <div id="content">
 </div>
</div>
 <div id="bottom"></div>                                      

Open in new window

#wrapper {
 background: url('top.jpg') top center no-repeat;
}
#bottom {
height: /*this should be as high as the bottom.png or less*/
background: url('bottom.png') bottom center no-repeat;
}

Open in new window


You can see a working example of this here on the blue sidebar. Also note a I've got a painterly border for the content area, this is using the tile solution I first suggested:
http://thehouseofsixdoors.com/about/

If you view source in firebug you'll see that there's a sidebar wrapper with a long image and a <p> (I used this instead of a div) for the bottom. There's a bit more going on because I had to work the horizontal shadows in above and below the social media. So here's some code to use:

<div id="sidebar-wrapper">
 <div id="content">
  ....
 </div>
</div>
 <div id="bottom"></div> 

Open in new window

CSS
#sidebar-wrapper {
    background: url("images/sidebar-bg3.jpg") no-repeat top center;
    width: 301px;
}
#bottom {
    background: url("images/tweet-bg.png") no-repeat  bottom center;
    height: 13px;
    width: 301px;
}

Open in new window

 

Play around with that code and add the following images. Sorry the images aren't semantic and that one's a png and one's a jpg, but you get the idea:

image for the sidebar wrapperimage for the bottom
0
 
asp_net2Author Commented:
@laughhearty

How did you make the grungle looking borders?

Could this also be achieved if I add border images for each side of the square element and then just place the content in the middle?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now