We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
Bit of css help
At the moment for my header I have a image along the top, the css for this is.
body {
text-align:center;
background:url(background.png) repeat-x #fff;
font-family: arial;
}

I'm trying to get the black colour to go along at the bottom (the Blah blah blah part), however the way I've done it in the past is with a div, and set the background colour, however it leaves a small gap to the left and right, I want it to go across the page like the header.
Does anyone know how to do it? I've seen it done on a few sites, but have no idea how!
Any help would be great.
Thanks.
Comments
-
When you do it with a div do you set the padding and margin properties to be zero?0
-
It looks like you've got a margin on the main body text and your footer may be embedded within that.
Treat the header as a separate div as well as the footer, doing something like this...
Stylesheet:body {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
#header {
text-align:center;
background:url(background.png) repeat-x #fff;
}
#footer {
background-color: black;
}
HTML:<body>
<div id="header">text</div>
Lorem ipsum dolor sit amet......
<div id="footer">other text</div>
</body>
If you then want to add other styles to the main body text, you can do as you wish.I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
0 -
It looks like you've got a margin on the main body text and your footer may be embedded within that.
Treat the header as a separate div as well as the footer, doing something like this...
Stylesheet:
HTML:
If you then want to add other styles to the main body text, you can do as you wish.
Thanks! Gave it ago and it still had the little margin each side, got round it by adding.margin: -8px;
No idea if its the correct way, but works!
Thanks
. What is pi? Where did it come from?0 -
May not be the most elegant way, but it does the job! If you could post a link to whever the page is and don't mind people looking, or post all the related code here, you might get some alternative suggestions. If you've tried different browsers though, and it seems to work OK, then you can press on with other tasks....
I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
0 -
http://ki3r.org/ki3r/
I've not had a chance to test it in other browsers or different screen sizes, hopefully it will look OK without a scroll bar though!What is pi? Where did it come from?0 -
Doesn't look too bad, just a few suggestions though....
No need to specify font in P, H1 etc., just in body is enough. Also use
font-family: Verdana, Arial, Helvetica, sans-serif;
It helps with systems that don’t have Arial installed by default, like MACs.
It's better for compatibility to have a DOCTYPE statement at the start of each html page like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Take out margin:-8px; from footer style and put margin:0; in body style, then add margin: 8px in p style (or whatever margin you want). That's neater and gives you better control, plus it makes sense!
Firefox doesn’t like the menu by the way, but Chrome is OK with it.I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
0 -
Thanks for that!
Do you have any ideas on how to get around the FireFox issue? Works in Safari as well.What is pi? Where did it come from?0 -
Add this to the stylesheet:
#nav {
position:absolute;
top: 170px;
width:100%;
text-align:center;
}
You can set the top position to whatever you want.
You'll also need a DOCTYPE in your html page to keep IE (and probably other browsers) happy.
Even though IE is the most popular browser, don't rely on it displaying pages as other browsers (or even other versions of IE) will. IE is notorious for not complying with established W3C standards and only Micro$oft could get away with releasing it. IE6 was dreadful, IE8 is better and hopefully IE9 will fall into line even more. I'll get off my soapbox though!;)I’m a Forum Ambassador and I support the Forum Team on the In My Home MoneySaving, Energy and Techie Stuff boards. If you need any help on these boards, do let me know. Please note that Ambassadors are not moderators. Any posts you spot in breach of the Forum Rules should be reported via the report button, or by emailing forumteam@moneysavingexpert.com.
All views are my own and not the official line of MoneySavingExpert.
0
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.4K Banking & Borrowing
- 253.7K Reduce Debt & Boost Income
- 454.4K Spending & Discounts
- 245.5K Work, Benefits & Business
- 601.3K Mortgages, Homes & Bills
- 177.6K Life & Family
- 259.4K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards