Centering The Page - Like MSN.com and some other sites

free web hosting
Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Centering The Page - Like MSN.com and some other sites

FirefoxRocks
Many sites have a ~780px layout because it fits well with a 800x600px resolution monitor. The problem is that I want the whole thing centered in the middle of the screen with equal margins at the sides. My CSS is at http://portal.trap17.com/wdl/styles.css and as you would probably guess, my site is at http://portal.trap17.com/wdl/

It is centered in Gecko (Firefox) browsers, but in Internet Explorer it isn't centered. No matter what I use, whether it is a container <div> or centering the <html> and <body> elements, it just doesn't work in Internet Explorer dry.gif

I use a table for layout (yes, I know it is a bad habit) and I serve my pages text/html to IE and application/xhtml+xml to Firefox and Opera. Maybe that might be the problem?

NOTE: This problem was also posted in the W3Schools forum, but no one found a solution yet sad.gif

 

 

 


Reply

faulty.lee
I use
CODE
<center>


I just tested. I saved a copy of your index. Then apply the changes, voila

This is part of the changes I've done
CODE
......
<body>
<div id="outer"><center>
<table id="page">
......
</table></center>
</div>
......


That's it. Good luck

EDIT: I've only tested it on Firefox 2.0 and IE6 (Winxp SP2)

Reply

pyost
As far as I can see from your source code, inside the <body> tag you have one DIV, and then one TABLE. The simplest solution would be to remove the DIV container (as it is not necessary this way), and add align="center" to the TABLE tag. This will center the main table in all browsers. However, web developers/designers usually don't like this solution as it is, how I like to call it, "outdated". You can do exactly the same thing with the DIV container, and it's quite simple - you probably just didn't try this combination.

The only thing you need to change is the CSS. In the body properties, include text-align: center (aligns the whole page in Internet Explorer), and in the #outer properties use margin: 0 auto 0 auto and text-align: left. The first one centers the DIV, and the second one is used to nullify the effect text-align: center (from the BODY) would have on the text inside the DIV.

@faulty.lee

I don't think "center" is a valid XHTML tag wink.gif It's even more "outdated" than the align="center" solution I mentioned laugh.gif

 

 

 


Reply

faulty.lee
QUOTE(pyost @ Apr 18 2007, 09:39 PM) *
I don't think "center" is a valid XHTML tag wink.gif It's even more "outdated" than the align="center" solution I mentioned laugh.gif


Sorry, bout that, didn't notice it was a xhtml. Well, just want to get a quick workaround. Thanks for pointing out

Reply

livingston
Use the following code to align the enite contents of the page in the center of the page, i.e the contents of <div> tag. This will also reset the alignment of the contents within the <div> tag to left.

CODE
body
{
text-align: center;
}
div#container
{
margin-left: auto;
margin-right: auto;
width: 50em;
text-align: left;
}

Reply

TavoxPeru
QUOTE(FirefoxRocks @ Apr 18 2007, 08:18 AM) *
Many sites have a ~780px layout because it fits well with a 800x600px resolution monitor. The problem is that I want the whole thing centered in the middle of the screen with equal margins at the sides. My CSS is at http://portal.trap17.com/wdl/styles.css and as you would probably guess, my site is at http://portal.trap17.com/wdl/

It is centered in Gecko (Firefox) browsers, but in Internet Explorer it isn't centered. No matter what I use, whether it is a container <div> or centering the <html> and <body> elements, it just doesn't work in Internet Explorer dry.gif

I use a table for layout (yes, I know it is a bad habit) and I serve my pages text/html to IE and application/xhtml+xml to Firefox and Opera. Maybe that might be the problem?

NOTE: This problem was also posted in the W3Schools forum, but no one found a solution yet sad.gif

Hi, can you try to use the margin property setting to 0 auto, i use the following css code to center a page:
CODE
html {height:100%;padding:0;margin:0;}
body {height:100%;color:#000;font-family:Verdana,Georgia,sans-serif;font-size:100.1%;margin:0;text-align:center;padding:0;}
#maincontent {width:780px; text-align:left; margin: 0 auto; }
/* other stUff */

Best regards,

Reply

Cory R.
I have been looking for a solution to this for a while now!
And when I look at what you said, it's like...really basic! Nothing all that advanced!
Why I never figured it out, I couldn't tell you....

Thanks a million for letting us know! I'm very happy now!!! laugh.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : centering, page, msn, sites

  1. Hacked By Dumansal
    When clicking on FAQ link at top of page (2)
  2. Hidden A Page Url
    (1)
    Hi. I have an ads toolbar and I need to show a page portion of a website, but I need hide a URL of
    this page. Anyone know if this is possible? Thanks in advance.....
  3. Make It Impossible To View Page Source
    (11)
    Hi! I was just wondering if it is possible to make username unable to view the page source.. I
    know that you can disable right click, but still, they can go to the page source from the navigation
    menu on the top of the browser.. if possible, I would really like a code that works on all browsers.
    Or if you know different codes that works on different browsers.. Thanks //Feelay....
  4. Similar Page Checker
    (0)
    The Similar Page Checker tool will help you to make sure you're not being penalized by search
    engines for duplicate content! People don't like repetitive things, and neither do search
    engines. Even if you've differentiated all your pages from the rest of the web, the engines may
    decide that they look like each other. The Similar Page Checker tool lets you determine the exact
    percentage of similarity between any two web pages. Simply enter both URLs and you'll be well on
    your way to eliminating overlap and getting the best possible search ranking.....
  5. How To Create A "user Profile" Page.
    No design (easy to add later if you want). (0)
    Hi! It was a long time ago I created a tutorial, so I've decided to create a new one
    /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> This time, I am
    going to teach you, how to create a "user profile page". Lets say I am logged in on my account, and
    want to view someone else account information (in this case, only his username, but you can add more
    things later). Then I'll press on a link, that will take me to his user profile. But before
    you can do that, you will have to create a register script, and a login script. If y....
  6. Updating Only One Thing In A Page?
    (3)
    Hey! I just wanted to know: Is it possible to update only one thing on a page? Lets say I have
    an "About Us" page. Is it possible to have "links" or something, so that when I press on them (one
    of the links), text/information about the person I pressed on will appear on the page, but the whole
    page wont update? Something like flash, but I want to use PHP/HTML instead (or whatever language I
    need, but I think it is PHP). And OFC /tongue.gif" style="vertical-align:middle" emoid=":P"
    border="0" alt="tongue.gif" /> if possible, can anyone be kind enough to tell me....
  7. Javascript Tutorial For Beginner
    Using Javascript in HTML page (0)
    In this tutorial I will show you how you can put JavaScript in a HTML page. It is very easy to add
    JavaScript in a HTML page. We will use <script> tag for this purpose. Inside the <script>
    tag, we will use "type=" attribute and will define the scripting language. We will define the script
    language as “text/javascript”. After define the script language we will add our
    JavaScript codes and at last we will close the tag using . So the complete code will be- CODE
    <html> <body> <script type="text/javascript"> (Pla....
  8. How To Create/edit/delete Ftp Accounts With Php
    Help me to create one php page to create FTP user accounts in Unix Ser (1)
    Thanks /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> ....
  9. Content Sites And Mini Sites
    (1)
    Content sites usually profit by educating their visitors. For example, a content site focusing on
    dog grooming might provide a basic tutorial to assist their visitors in learning how to groom a dog.
    They provide this tutorial completely free; however, the main purpose for this tutorial is to
    educate their visitors and promote their products. When you provide your visitors with quality
    information that teaches and informs, you are not only gaining their trust in you by sharing your
    expertise, but you're also building your credibility, which is very important on the ....
  10. Sitepoint's Css And Html Reference Sites
    (2)
    Recently the folks at SitePoint.com launched two excelent online reference sites for web designers
    and developers, the first one is the SitePoint CSS Reference and the second one is the SitePoint
    HTML Reference (Beta) . Both of them are free and available to anyone and everyone who needs to
    lookup any information related to CSS and HTML in an easy and fast way. The SitePoint HTML
    Reference (Beta) is still in progress. Also, both of them are very detailed and up-to-date on each
    subject and are focused not only to beginners because they covers from general to advance....
  11. Unintrusively Streaming Pdf Documents Into A Web Page
    (2)
    I am looking for a way to unintrusively stream PDF documents into a web page (without the Acrobat
    Reader plug-in or what have you, kicking in). Kind of like YouTube streams an FLV video into a page.
    What I have found so far are things like iPaper (http://www.scribd.com/ipaper) but on closer
    examination it looks like this one is streaming SCB documents (in this particular instance the
    document at documents.scribd.com/docs/2ilx1b8u571leozv8qrd.scb) - but it begs the question what the
    heck is a .SCB document anyway (I tried pulling it down to my hard drive and renaming it t....
  12. Was My Site Data Copied By Someone?
    Same index page (6)
    I just found this site: asta-killer dot com and as you can see, it's a copy of mine index on
    astahost: http://qzone.astahost.com the strange thing is that when you enter something like:
    asta-killer dot .com/list/ a directory or file which doesn't exist, you get an error, but the
    error is from my php script on astahost.. So that means that that index file isn't only copied
    html, but also somehow they got my php source? what a hell is that? then OK I thought it is a remote
    thing, but it's impossible on my account to get such an error at all, because th....
  13. Server Status Page Gone
    (1)
    Ok, this isn't a big problem since I still got cPanel to check the status, but the server status
    page that resides with the helpdesk is gone. QUOTE Not Found The requested URL
    /helpdesk/index.php was not found on this server. Additionally, a 404 Not Found error was
    encountered while trying to use an ErrorDocument to handle the request. Apache/1.3.37 Server at
    xisto.com Port 80 xboxrulz....
  14. Acer Desktop/laptop Drivers Download
    Acer Drivers Download Sites (0)
    Hello, Due to the big popularity of Acer computers in Iraq espcially Laptops, I use the following
    sites to download any needed drivres for Acer computers. Download Sites: Drivers and utillities
    -----------------------------------------------------------------------------------
    http://support.acer-euro.com/drivers/downloads.html ==============================================
    Manuals ----------------------------------------------------------------------------------
    http://csd.acer.com.tw/acer/URMUL1.NSF/1?O...mp;Collapse=7#7
    =====================================....
  15. Problem With Purchase Credits Page
    Problem with Purchase Credits Page (7)
    I was trying to checkout the Purchase Credits section, today, and found a dead end to 404.
    http://www.astahost.com/purchase_credits.htm I was using the link from the menu above ->
    Credits\Purchase Credits Need to buy some credit, I'm really busy lately with my work, not
    much time to keep track of post. Btw, I have a question here too. I seems that if I'm inactive
    for a while, like not posting for a few days, the email alert for new post will not come anymore. Is
    it a feature or a bug?....
  16. Can't Access Astahost Hosteed Sites (including Cpanel And Ftp)
    (21)
    Well its been about a week now since i havent been able to access anything hosted on the gamma
    server (including the gamma.xisto.com address) and its starting to annoy me. my brother "co-owns" a
    site hosted here and he hasnt been able to go on it or anything so he told me to ask about it. So
    it was when i was uploading EZ Publish (via ftp) to my site it happened. after like 500 files it
    lost connection and wouldnt connect. later on i found that i couldnt get on my site or cpanel
    either. i then went on my best friends site hosted here and couldnt access it so i went on o....
  17. Juggling An Iframe Box With Xhtml Sites
    How to make it strict and valid (8)
    You most likely have encountered a situation (as a web developer) where you have an iframe box and
    you are using valid XHTML Strict. Iframes are still valid in FRAMESET and TRANSITIONAL XHTML but it
    is best to use XHTML 1.0 Strict or XHTML 1.1 (application/xhtml-xml). A method for including iframes
    have been found. It doesn't use the tag at all. Since tags are depreciated, new tags/CSS are
    to replace them (except DOM, which is a little off topic here). The and tags were replaced by
    . Yes, is for inserting any foreign object into XHTML documents. Since I....
  18. Bypassing Filtered Sites
    Getting around your admin (29)
    I decided today that i was sick of my filter at school. Usually i would abide the rules but today
    the fillter whent too far, looking for people who cheated in the Olympic games and it wouldn't
    even let me search the topic. Bypassing was the only way. it just pisses me off that the tool that
    they have given us is so restricted that it is usless. So im sending a big F you /mad.gif"
    style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif" /> to the people who made
    Bess. If you have a good unblocked proxy list it here.....
  19. How To Increase Your Google Page Rating ?
    ??? (11)
    Hey. My church website is http://www.cedarvalley.ca (Cedar Valley Mennonite Church) but it's
    not #1 on Google Search--yet it is on Altavista/Yahoo!. How come? And how can I make it so that
    it is? P.S. I have many spellings/variations on the name in the meta tags. Any suggestions?....
  20. PHP Tutorial: Form Verification And Simple Validation
    A One Page script for PHP form verification. (12)
    Having used various means of verifying HTML forms I believe that this method of verifying a form
    to be the best mostly because it does everything on one page. It presents the form on one page and
    then when the submit button is pressed, if all the required fields are not filled out then it will
    present the form again with all the fields intact and in red lettering will point out the fields
    that are required to be filled out in red. It is not possible to click submit using this method even
    if the user has turned JavaScript off. While it is possible to use javascript to ....
  21. Some Of The Best Soccer Sites ( Add More To This )
    please add some ! (4)
    Ok.... now it's time to review the best soccer sites ! If i shouldn't be posting this
    type of reviews, i whould like someone to let me know ! This are the main soccer sites that may
    interest you, but there might be other good sites, so add your favorite soccer sites ! This time
    i will add a rating from 1 to 10 that represents, in my opinion ,it's usefulness, the design and
    how easy you can find the info you need ! www.livescores.dk 7/10 This is where you will find
    all the live scores you want ! They have a list of sites where you will f....
  22. Tennis Sites
    the best tennis-related sites on the net (4)
    www.atptennis.com This is the official site of the atp, the asosacion de tennis professionel.
    Here you will find,under a modern look, the ATP calendar and news, the singles and doubles complete
    rankings, a beautifull photo gallery, small clips and informations about each player ! If
    you want to find out something about an atp player or an atp event this is the place to be !
    www.tennisserver.com This is a tennis site where you will find articles about the players, some
    tennis tips and articles about tennis technology ! The site has 5 categor....
  23. Free Photo Storage Sites.
    The good & bad? (10)
    I use both Opera Albums and Image Cabin for my photos, Opera has 300mg space and Image Cabin
    250mg. Are there any out there with more space that let you share your pics if you want to, with
    good resolution?....
  24. A Solution For Disabled Right Click On Web Page
    (19)
    a solution for disabled right click on web pages!!?? /blink.gif' border='0'
    style='vertical-align:middle' alt='blink.gif' /> Webmasters may disable right click on web pages
    by Java Script for copyright purposes. follow below ways to right click: 1- Hold down middle button
    and press right button. 2- Hold down left button and press right button. 3- Press Esc or Enter and
    right button contemporaneously. 4- Press specific button on keyboard. Be successful /cool.gif'
    border='0' style='vertical-align:middle' alt='cool.gif' /> ....
  25. How To Increase Windows Shutdown Speed
    when you enabled “clear Page File at shu (39)
    How to increase Windows shutdown speed when you enabled “clear Page File at shutdown”? /blink.gif'
    border='0' style='vertical-align:middle' alt='blink.gif' /> Note that making incorrectly changes
    to the registry may damage your system; please back up any valued data on your computer. 1) Go to
    Start menu > Run > and type regedit and click OK. 2) Find following address: HKEY_LOCAL_MACHINE
    \ SYSTEM \ CurrentControlSet \ Control \Session Manager \ Memory Management
    3) In right side right click on “ClearPageFileAtShutdown”, select Modify and mak....
  26. Online Dating Sites
    Do you use them? (15)
    I have seen lots and lots of advertising for Online Dating Sites on lots of website like Astahost
    with ads like: I was wondering how many people use these online dating sites? Personally I
    don't think that they are good to use and I would never use them........
  27. Free Links Exchange: Promote & Increase Page Rank
    (9)
    Hi guys, For all the aspiring web-designer and webmasters out there - this deals with one of the
    most commonly overlooked fact about increasing your page rank. Most of us after putting up a new
    site, are satisfied with simple submitting our site to multiple search engines using some of the
    free submission engines. After that it's a long long wait till the crawlers come over to our
    page and starts indexing them. Even then it doesn't work out that well. And we always keep
    wondering WHY our sites don't show up on higher ranks on search engines. One of the p....
  28. Visual Web Developer 2005 Express Edition Beta 2
    Visually create asp.net Web page (13)
    Microsoft has released “Visual Web Developer 2005 Express Edition Beta 2”. Claimed to provide
    everything you need to begin building Web applications with ASP.NET 2.0. It provides: QUOTE
    · Visual designers that make creating Web applications easy via an easy-to-use drag-and-drop
    interface · Powerful code editor with rich functionality such as IntelliSense that makes writing
    code and HTML faster · Quickly create data-driven Web applications using the built-in data controls
    and integrated access to Microsoft SQL Server 2005 Express · Support for multiple languages: ....
  29. Music Sites
    Where to find url's for music.... (25)
    Ok this is not right I have a myspace and I cant find any place to get URL'S for music for my
    site...I hate it....Where do you go to get your music for your site? I found places to put music
    videos on but i dont want that i just want a place to find url's for my page...any help
    please...............................................

    ....
  30. full flash sites
    good or bad? (60)
    what do you think of flash sites that load forever /biggrin.gif' border='0'
    style='vertical-align:middle' alt='biggrin.gif' /> ....

    1. Looking for centering, page, msn, sites

Searching Video's for centering, page, msn, sites
Similar
Hacked By
Dumansal -
When
clicking on
FAQ link at
top of page
Hidden A
Page Url
Make It
Impossible
To View Page
Source
Similar Page
Checker
How To
Create A
"user
Profile"
; Page. - No
design (easy
to add later
if you
want).
Updating
Only One
Thing In A
Page?
Javascript
Tutorial For
Beginner -
Using
Javascript
in HTML page
How To
Create/edit/
delete Ftp
Accounts
With Php -
Help me to
create one
php page to
create FTP
user
accounts in
Unix Ser
Content
Sites And
Mini Sites
Sitepoint
9;s Css And
Html
Reference
Sites
Unintrusivel
y Streaming
Pdf
Documents
Into A Web
Page
Was My Site
Data Copied
By Someone?
- Same index
page
Server
Status Page
Gone
Acer
Desktop/lapt
op Drivers
Download -
Acer Drivers
Download
Sites
Problem With
Purchase
Credits Page
- Problem
with
Purchase
Credits Page
Can't
Access
Astahost
Hosteed
Sites
(including
Cpanel And
Ftp)
Juggling An
Iframe Box
With Xhtml
Sites - How
to make it
strict and
valid
Bypassing
Filtered
Sites -
Getting
around your
admin
How To
Increase
Your Google
Page Rating
? - ???
PHP
Tutorial:
Form
Verification
And Simple
Validation -
A One Page
script for
PHP form
verification
.
Some Of The
Best Soccer
Sites ( Add
More To This
) - please
add some
!
Tennis Sites
- the best
tennis-relat
ed sites on
the net
Free Photo
Storage
Sites. - The
good &
bad?
A Solution
For Disabled
Right Click
On Web Page
How To
Increase
Windows
Shutdown
Speed - when
you enabled
“clear Page
File at shu
Online
Dating Sites
- Do you use
them?
Free Links
Exchange:
Promote
&
Increase
Page Rank
Visual Web
Developer
2005 Express
Edition Beta
2 - Visually
create
asp.net Web
page
Music Sites
- Where to
find
url's
for
music....
full flash
sites - good
or bad?
advertisement




Centering The Page - Like MSN.com and some other sites



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE