Reply
Banner using CSS
Old 05-09-2007, 04:13 PM Banner using CSS
PN-Matt's Avatar
Skilled Talker

Posts: 74
Hi,

Does anyone know how to create a banner using CSS like the one attached?

I am trying to add something similar to my blog.

Can someone give me some code as a example please?

(Just used the MyBB one as a example )

Thank you
Attached Images
File Type: jpg bar-css.jpg (9.7 KB, 10 views)

Last edited by PN-Matt : 05-09-2007 at 04:22 PM. Reason: Requesting a mod to move. Accidently posted this in the wrong forum
PN-Matt is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-09-2007, 04:30 PM Re: Banner using CSS
King Spam Talker

Posts: 1,004
Location: Manchester, UK
Use a graphics program to create a narrow vertical cross section of the banner (so that the weight of the image is small) and then use background-repeat along the x-axis like this:

HTML Code:
background: url(bg01.jpg) repeat-x;
For example the horizontal blue bar here is done that way: http://www.mediafire.com/

Last edited by gringo : 05-09-2007 at 04:31 PM.
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 05-09-2007, 04:56 PM Re: Banner using CSS
PN-Matt's Avatar
Skilled Talker

Posts: 74
Thanks, Where do I place this code?

I take it I place it in my css file? Then what HTML would I need to add for it to show?

I tried putting it in my .css file and my background turned white.

Any assistance with this and I would be grateful.

Thank you
PN-Matt is offline
Reply With Quote
View Public Profile
 
Old 05-09-2007, 05:08 PM Re: Banner using CSS
King Spam Talker

Posts: 1,004
Location: Manchester, UK
Yes that goes in your css. You would have something like this for the banner text:

HTML Code:
<div id="banner">Latest News yada yada</div>
and then your css would say:

HTML Code:
#banner {
background: background: url(bg01.jpg) repeat-x;
padding: 10px 0;
}
The padding is there just to give the div a bit of height (there might be more elegant ways to do this that LadynRed will show us when I've made a hash of this )so that your background image shows. If you get stuck, post a link to the page that has the problem.
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 05-09-2007, 05:29 PM Re: Banner using CSS
PN-Matt's Avatar
Skilled Talker

Posts: 74
Hi,

The blog is http://www.mixedmatt.com

You can see near the top it says "test". It's still not working. I think it's a problem with the wordpress theme somewhere. Something in the css regarding that theme but I really am not experienced in this area.

Thanks for your assistance
PN-Matt is offline
Reply With Quote
View Public Profile
 
Old 05-09-2007, 05:34 PM Re: Banner using CSS
King Spam Talker

Posts: 1,004
Location: Manchester, UK
If you look in the css file here http://www.mixedmatt.com/wp-content/...s-10/style.css

you have:
HTML Code:
background: background: url(http://www.mixedmatt.com/wp-content/themes/digg-3-columns-10/images/bg01.jpg) repeat-x;
The 'background' should only occur once.

Also, you would be better using a vertical cross section for your image that would repeat well horizontally, like this http://www.mediafire.com/images/main_fade.gif

Last edited by gringo : 05-09-2007 at 05:36 PM.
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 05-09-2007, 05:49 PM Re: Banner using CSS
angele803's Avatar
Perfectly Imperfect

Posts: 1,605
Name: Stephanie
Location: Oklahoma
Try to change your CSS for #banner to this:

#banner {
background: url(http://www.mixedmatt.com/wp-content/...mages/bg01.jpg) repeat-x;
padding: 10px 0;
text-align: center;
}

****Edit****
Also, if you are just using a solid color for your background, just add the color to your CSS:

The color you have in your background image is FB4C49

So your CSS would look like this:

#banner {
background: #FB4C49 url(http://www.mixedmatt.com/wp-content/...mages/bg01.jpg) repeat-x;
padding: 10px 0;
text-align: center;
}

Last edited by angele803 : 05-09-2007 at 05:55 PM.
angele803 is offline
Reply With Quote
View Public Profile
 
Old 05-09-2007, 06:24 PM Re: Banner using CSS
LadynRed's Avatar
Super Moderator

Posts: 6,699
Location: Tennessee
Unless there's a pattern to that bar that I can't see, there's no reason to use an image at all. Define the <div> to the height you want, then give it the yellow background color. Next you add a 2px solid border at the top and bottom in the darker gold color.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-09-2007, 06:58 PM Re: Banner using CSS
PN-Matt's Avatar
Skilled Talker

Posts: 74
http://www.mixedmatt.com

Getting closer. The top part is now red too.

Thanks for the assistance all. Ladynred I tried that method and had no idea what to do.

I used the code from angele803 post.

Matt
PN-Matt is offline
Reply With Quote
View Public Profile
 
Old 05-10-2007, 04:58 AM Re: Banner using CSS
King Spam Talker

Posts: 1,004
Location: Manchester, UK
For the borders you will need:

HTML Code:
border-top: 2px solid #f00;
border-bottom: 2px solid #f00;
Alter the 2px to change the width and the #f00 to change the colour.
gringo is offline
Reply With Quote
View Public Profile Visit gringo's homepage!
 
Old 05-10-2007, 12:03 PM Re: Banner using CSS
angele803's Avatar
Perfectly Imperfect

Posts: 1,605
Name: Stephanie
Location: Oklahoma
Try this:

#banner {
background: #FB4C49;
padding: 10px 0;
text-align: center;
border-top: 2px solid #f00;
border-bottom: 2px Solid #f00;
}

I think that should do it! (some of this was taken from other people's suggestions. I just wanted to put it together so it would be easier for you)
angele803 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Banner using CSS
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 1.58002 seconds with 13 queries