SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist perpetual_dream's Avatar
    Join Date
    Nov 2005
    Location
    Jerusalem
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ceentering the div but not the text inside?

    Hey,
    I want to know how can one put a div at the center of the page, but i dont want the text inside to be centralized too.... i want the centering to be just for the position of the div
    Tanzeelnet - Best arabic downloadsite
    Linux Hosting |Free Downloads |

  2. #2
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <body>
     <div id="thediv">
      <p>Contents</p>
     </div>
    </body>

    Code:
    body {
     text-align: center;
    }
    
    div#thediv {
     text-align: left;
     margin-left: auto;
     margin-right: auto;
    }
    Should work

  3. #3
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The div needs a width too for the auto margin centring method to work.

  4. #4
    SitePoint Evangelist perpetual_dream's Avatar
    Join Date
    Nov 2005
    Location
    Jerusalem
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thnx
    Tanzeelnet - Best arabic downloadsite
    Linux Hosting |Free Downloads |


Bookmarks

Posting Permissions

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