www.webdeveloper.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 43

Thread: How do I centre a webpage?

  1. #16
    Join Date
    Oct 2009
    Location
    Manitoba
    Posts
    36
    , now try putting into a table. as what we are talking about in this thread.

    Result: Passed, 1 warning(s)

    The warrning is nothing, its the normal "Direct Input mode: UTF-8"

    HTML Code:
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <table width="302" border="0" cellpadding="0" cellspacing="0" align="center">
      <!--DWLayoutTable-->
      <tr>
        <td width="29" height="13"></td>
        <td width="247"></td>
        <td width="26"></td>
      </tr>
      <tr>
        <td height="158"></td>
        <td valign="top">TABLE HERE </td>
        <td></td>
      </tr>
      <tr>
        <td height="33"></td>
        <td>&nbsp;</td>
        <td></td>
      </tr>
    </table>
    </body>
    </html>
    
    
    Last edited by jamesplamondon; 10-18-2009 at 07:51 PM.

  2. #17
    Join Date
    Oct 2009
    Location
    Manitoba
    Posts
    36
    Actuly i dont mean good, you didnt do your codes right.

    Result: Passed, 1 warning(s)


    HTML Code:
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    <p align="center"> 
    info goes here
    </p>
    </body>
    </html>

  3. #18
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163

    Why would you use a transitional doctype on a new document? You are
    not transitioning from anything.

  4. #19
    Join Date
    Oct 2009
    Posts
    15
    I've actually never figured out any of the proper ways of doing things any good resources on that? for example what meta's are required when to use what doctype etc. (sorry for the off subject but they started the thought^^)

  5. #20
    Join Date
    Sep 2006
    Location
    MA
    Posts
    494
    This is so much easier with CSS. Do something like this...

    HTML Code:
    <style type="text/css">
    #wrapper { width: 800px; margin: 0 auto; }
    </style>
    
    <div id="wrapper">
    CONTENT OF PAGE GOES HERE
    </div>
    This will make a div of only 800px in width and then set it into the center of the page, regardless of monitor width.

  6. #21
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163
    Quote Originally Posted by Jerm993 View Post
    I've actually never figured out any of the proper ways of doing things any good resources on that? for example what meta's are required when to use what doctype etc. (sorry for the off subject but they started the thought^^)

    The authoritative source is http://www.w3.org. For example, see http://www.w3.org/QA/2002/04/valid-dtd-list.html

    My pages always begin with:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
      <head>
        <title></title>
        <link href="" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      </head>
      <body>
        <h1></h1>
    (I use an emacs macro to insert it when I start a new HTML page.)
    Last edited by cfajohnson; 10-18-2009 at 09:16 PM.

  7. #22
    Join Date
    Oct 2009
    Posts
    658
    I think your validating it wrong. THe doctype is xhtml transitional. You're validating it as html strict. Oops on the wrong page of the thread. SOrry

  8. #23
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163
    Quote Originally Posted by ssystems View Post
    I think your validating it wrong. THe doctype is xhtml transitional. You're validating it as html strict. Oops on the wrong page of the thread. SOrry
    http://www.webdeveloper.com/forum/sh...4&postcount=18

  9. #24
    Join Date
    Oct 2009
    Posts
    658
    The transition there is transition from html to xhtml not transitioning from an old content to a new content if thats what you mean on you're reply. Cheers.

  10. #25
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163
    Quote Originally Posted by ssystems View Post
    The transition there is transition from html to xhtml not transitioning from an old content to a new content if thats what you mean on you're reply. Cheers.

    But why would you switch to XHTML when it is not supported by the most-used browser?

  11. #26
    Join Date
    Oct 2009
    Location
    urgh! sometimes even he doesn't know :S
    Posts
    12
    LoL! What has this thread become? LoL!!!

    Originally I was look to just centre the page in the centre... And that is what I got... Or at least that is what it seems to me on my monitor with a resolution of 1680 x 1050.

    My mind is telling me to use a percentage instead of a fixed number... meh... but what do I know?

  12. #27
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163
    Quote Originally Posted by isa View Post
    My mind is telling me to use a percentage instead of a fixed number...

    Use a percentage width and a max-width in ems:

    Code:
    width: 90%;
    max-width: 37em; /* adjust to taste; text should generally not exceed 37em */
    margin: 0 auto;

  13. #28
    Join Date
    Oct 2009
    Location
    urgh! sometimes even he doesn't know :S
    Posts
    12
    Quote Originally Posted by cfajohnson View Post

    Use a percentage width and a max-width in ems:

    Code:
    width: 90%;
    max-width: 37em; /* adjust to taste; text should generally not exceed 37em */
    margin: 0 auto;
    cfajohnson, your knowledge truly humbles me.

    I am but a poor peasant when it comes to the laws of webpage building... nay, but a servant to a peasant... ermm... well, ok, maybe not that bad, but you get the drift...

    I really would love to be able to make heads or tails of what you just put up there, but alas, I can't, for the life of me

  14. #29
    Join Date
    Oct 2009
    Location
    urgh! sometimes even he doesn't know :S
    Posts
    12
    I did say that I am a newbie yeah?

    I only know very limited HTML... no XHTML (even though I would love to be able to), no CSS, no ems no nothing...

    Just very, very, VERY limited HTML

  15. #30
    Join Date
    Sep 2009
    Location
    Toronto, Ontario, Canada
    Posts
    163

    For a start, put this inside the HEAD element of your page:

    Code:
    <style type="text/css">
    body
    {
     width: 90%;
     max-width: 37em;
     margin: 0 auto;
    }
    </style>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles