How to center ?

Discussion in 'HTML & Website Design' started by SEOdir.net, Jun 24, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Hello,
    http://www.seodir.eu/submit.php

    how to center that table ? :)

    Code:

                    <div class="pasek" align="center">
             {l}Information{/l}
          </div>
          <div class="info" align="center">
             {l}You must be logged in to submit a new link.{/l}
             <br />
             {l}No account yet?{/l} <a href="{$smarty.const.DOC_ROOT}/profile.php?mode=register" title="{l}Register new user{/l}">{l}Create one{/l}</a>   
    					</div>
    Code (markup):
    CSS:

    .pasek{
      background: url(../images/cat.jpg);
      border-top: 1px solid rgb(191,191,191);
      border-left: 1px solid rgb(191,191,191);
      border-right: 1px solid rgb(191,191,191);
    	width: 500px;
    	text-align: center;
    	font: bold 10px Verdana;
    	margin: 0;
    	padding: 0 0 2px 5px;
    }
    .info{
      border: 1px solid rgb(191,191,191);
    	width: 495px;
    	height: 37px;
    	margin: 0;
    	padding: 3px 5px 3px 5px;
    	text-align: center;
    }
    Code (markup):
    Thank you ;)
     
    SEOdir.net, Jun 24, 2007 IP
  2. nmx

    nmx Active Member

    Messages:
    557
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    <center>
    <div class="pasek" align="center">
    {l}Information{/l}
    </div>
    <div class="info" align="center">
    {l}You must be logged in to submit a new link.{/l}
    <br />
    {l}No account yet?{/l} <a href="{$smarty.const.DOC_ROOT}/profile.php?mode=register" title="{l}Register new user{/l}">{l}Create one{/l}</a>
    </div>
    </center>

    Just an idea. :p
     
    nmx, Jun 24, 2007 IP
  3. SEOdir.net

    SEOdir.net Banned

    Messages:
    2,549
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    173
    #3
    Ok works but its suggested to use the alignments of css, right ?
     
    SEOdir.net, Jun 24, 2007 IP
  4. nmx

    nmx Active Member

    Messages:
    557
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I'm not the right person to ask, I can't code atall. :p I just knew that that works for centering stuff. :D I imagine it's probably better to center with CSS to avoid confusion etc, but I can vaguely remember also having difficultys getting the CSS to center things..

    Good luck, hopefully someone knows the answer!

    -nmx
     
    nmx, Jun 24, 2007 IP
  5. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #5
    Your css code does not seem to have it.
     
    it career, Jun 24, 2007 IP
  6. SEOdir.net

    SEOdir.net Banned

    Messages:
    2,549
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    173
    #6
    So can you tell me what code do I need to add there ?
     
    SEOdir.net, Jun 24, 2007 IP
  7. PadraigCurran

    PadraigCurran Peon

    Messages:
    250
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Put a wrapper DIV around everything.

    
    <div id="wrapper">
    <!-- All content within this wrapper DIV -->
    </div>
    
    Code (markup):
    CSS:
    
    body {
    text-align: center; /* This is for older IE browsers */
    }
    
    #wrapper {
    width: 800px /* Or whatever width you want */
    margin: 0 auto;
    }
    
    Code (markup):
    Then use text-align: left; in the correct table to put the text back where it should be.
     
    PadraigCurran, Jun 24, 2007 IP
    SEOdir.net likes this.
  8. tandac

    tandac Active Member

    Messages:
    337
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #8
    I generally set my left and right margins of the surrounding div tag to auto.
     
    tandac, Jun 24, 2007 IP
  9. SEOdir.net

    SEOdir.net Banned

    Messages:
    2,549
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    173
    #9
    Thank you for your help guys, I will play with it afternoon.
     
    SEOdir.net, Jun 24, 2007 IP
Thread Status:
Not open for further replies.