| | #1 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,520
Thanks: 877
Thanked 988 Times in 699 Posts
![]() ![]() ![]() ![]() ![]() ![]() | 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://cdn1.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.
__________________ Free MacBook Air ಠ_ಠ |
| Offline | |
| | #2 |
| iBook Join Date: Feb 2008
Posts: 2,556
Thanks: 702
Thanked 447 Times in 388 Posts
![]() ![]() ![]() | Code: #header {
background: #ff0000;
width: 800px;
height: 300px;
position: top center;
margin: auto;
margin-top: 0;
padding: 0;
}
|
| Online | |
| | #3 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,520
Thanks: 877
Thanked 988 Times in 699 Posts
![]() ![]() ![]() ![]() ![]() ![]() | Still not working
__________________ Free MacBook Air ಠ_ಠ |
| Offline | |
| | #4 |
| Mini Mac | 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;
}
__________________ ![]() One, 21 guns. Throw up your arms. My Sites: Football Forum Free DSi | Free iPhone 3GS | Drake Bell | Cheap UK-Based Web Hosting Total received: £201.61 |
| Offline | |
| | #5 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,520
Thanks: 877
Thanked 988 Times in 699 Posts
![]() ![]() ![]() ![]() ![]() ![]() | 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.
__________________ Free MacBook Air ಠ_ಠ |
| Offline | |
| | #6 | |
| Mini Mac | Set the margin to -15px, that'll bring it up to the top in ie and firefox I think Quote:
__________________ Currently: ![]() My Sites Free Nintendo DSi www.macbook4u.co.uk Free Android Free PS3 Games open spoiler to see what im doing Spoiler Last edited by beezer123; 22-11-08 at 01:20 AM.. | |
| Offline | |
| | #7 |
| Are YOU talkin' to me? | 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; }
__________________ |
| Online | |
| | #8 | |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,520
Thanks: 877
Thanked 988 Times in 699 Posts
![]() ![]() ![]() ![]() ![]() ![]() | Quote:
@corky20: position: static doesn't make a difference, and display: inline makes it disappear
__________________ Free MacBook Air ಠ_ಠ | |
| Offline | |
| | #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.
__________________ Currently: ![]() My Sites Free Nintendo DSi www.macbook4u.co.uk Free Android Free PS3 Games open spoiler to see what im doing Spoiler |
| Offline | |
| | #10 |
| 1 new message Join Date: Jul 2007 Location: Omicron Persei 8
Posts: 2,520
Thanks: 877
Thanked 988 Times in 699 Posts
![]() ![]() ![]() ![]() ![]() ![]() | Finally! I added margin:0 to the body. The header CSS was fine, it's the body that had default padding.
__________________ Free MacBook Air ಠ_ಠ |
| Offline | |
![]() |
| Thread Tools | |
| |