| |||||||
This is a discussion on Small CSS issue within the Technical Help forums, part of the Off Topic category; I'm making a site and the header doesn't show right , it doesn't seem to stick to the top. It's ...
![]() |
| | Thread Tools |
| | #1 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,518
![]() ![]() ![]() ![]() ![]() ![]() | Small CSS issueI'm making a site and the header doesn't show right This is what's happening, but I want the that red rectangle to stick to the top. These are the CSS properties: Code: body {
background:#e6f3ff url(http://www.exceem.co.uk/forums/images/bg.gif) repeat-x;
color:#102840;
text-align:center;
}
#header {
background: #ff0000;
width: 800px;
height: 300px;
position: top center;
margin: auto;
padding: 0;
}
Thanks, Omair. |
|
| | #2 |
| Mini Mac Join Date: Feb 2008
Posts: 3,135
![]() ![]() ![]() | Code: #header {
background: #ff0000;
width: 800px;
height: 300px;
position: top center;
margin: auto;
margin-top: 0;
padding: 0;
}
|
|
| | #3 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,518
![]() ![]() ![]() ![]() ![]() ![]() | Still not working |
|
| | #4 |
| Mini Mac Join Date: Jul 2008 Location: London
Posts: 5,087
![]() ![]() ![]() ![]() | i barely know css so i doubt this will help: Code: #header {
background: #ff0000;
width: 800px;
height: 300px;
position: top center;
margin-top: 0;
padding: 0;
}
__________________ Help an old friend wrap up his freebie-ing by signing up for me in a trade on either Apple FJ or PS3 Kudos! £15 per green! (pm me and I'll set it up in the trade centre) |
|
| | #5 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,518
![]() ![]() ![]() ![]() ![]() ![]() | Nope, didn't work, it just moved it to the left. I think I need the margin: auto to keep it centred, which means that my position bit may be wrong. |
|
| | #6 | |
| Mini Mac | Set the margin to -15px, that'll bring it up to the top in ie and firefox I think Quote:
__________________ My Sites Free Nintendo DSi Free Macbook Pro Free Galaxy Nexus Free iPhone 4S Free iPad 2 open spoiler to see what im doing Spoiler Last edited by beezer123; 22-11-08 at 01:20 AM.. | |
|
| | #7 |
| Free The Gadgets | Don't really know CSS but try... #header { position: static; background: #ff0000; width: 800px; height: 300px; position: top center; margin: auto; margin-top: 0; padding: 0; } or #header { display: inline; background: #ff0000; width: 800px; height: 300px; position: top center; margin: auto; margin-top: 0; padding: 0; } |
|
| | #8 | |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,518
![]() ![]() ![]() ![]() ![]() ![]() | Quote:
@corky20: position: static doesn't make a difference, and display: inline makes it disappear | |
|
| | #9 |
| Mini Mac | argh I was close. Have a look on here css-tricks.com It's extremely helpful to me and hopefully to anyone else.
__________________ My Sites Free Nintendo DSi Free Macbook Pro Free Galaxy Nexus Free iPhone 4S Free iPad 2 open spoiler to see what im doing Spoiler |
|
| | #10 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,518
![]() ![]() ![]() ![]() ![]() ![]() | Finally! I added margin:0 to the body. The header CSS was fine, it's the body that had default padding. |
|
![]() |
| Thread Tools | |
| |