Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Website help

Author
Message
Nuklear Onslaught
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location: England
Posted: 21st Jul 2007 20:34
I usually used pre made templates, but this time I decided to start from scratch creating my own images etc. I am using Visual Web Developer 2005.

My problem is that I want my header to be centralised, but I can't do this because it is a div tag. If I remove this then it ruins the rest of my formatting. So basically, is there a way I can centre my header?

Here's my code


And a screenshot is attatched

Attachments

Login to view attachments
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 21st Jul 2007 22:41
The header looks centralized to me...

One thing you can do which works in "most" browsers (but not IE6 or earlier... obviously... very little really "works" in IE6) is use auto margins.

If you have a block element with a fixed width inside a larger block element then setting horizontal margins to auto will centre it... For example...


PS: In CSS, margin and padding (and anything else AFAIK which accepts a top, right, bottom and left set of numbers will also take less than the 4). Basically if you provide fewer than the 4 then the CSS parser will copy from the other side... example: margin: 0px 4px 8px; As there are only 3 values they will be: top=0, right=4, bottom=8, left(unset)=4 (as it inherits from right).
So in my example where I said '0px auto' that means top and bottom are 0px and left and right are auto. Its shorthand...

[center]
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 21st Jul 2007 22:44
Well, there are a couple of ways, but an easy way would be to center a table inside the div.



Best.

I'm sorry, my answers are limited. You must ask the right question.

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 22nd Jul 2007 05:44
Urg xplosys, no... No.

Don't center a table in anything.
Using what Nick said will work.

While CSS support in IE is flaky at best, you can center it using Nicks trick with a little tweaking. Just google it, there's plenty blog posts out there that deal with it.

Nintendo DS & Dominos :: DS Dominos
http://jt0.org
Nuklear Onslaught
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location: England
Posted: 22nd Jul 2007 12:54 Edited at: 22nd Jul 2007 14:16
Ok, i'll try doing Nick said. Thanks for all your help guys.

Damn it... I works fine in IE, but not Firefox. Now i'm kinda stuck.


Login to post a reply

Server time is: 2024-11-18 23:31:09
Your offset time is: 2024-11-18 23:31:09