Results 1 to 4 of 4

Thread: CSS Layout Problem In FireFox

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    34

    Resolved CSS Layout Problem In FireFox

    I want my contents right in the middle of page weather the screen resolution is 800x600 or
    higher. For that purpose i put one div as wrapper of page and set its text-align property
    center so the next contents can remain right in the middle. Now i put an other div
    in it with text-align property set to left-align. Now what should happen is that due to
    first div's text-align->center property the second div should apper in the middle but due
    to second div's text-align->left property the contents should set to left. It is working fine
    in Internet Explorer but Firefox is still display second in left.

    the code is as following

    Code:
    <html>
    <head>
    <title>Welcome To My Webpage</title>
    <style>
    
    #w
    {
     height: 100%;
     width: 100%;
     text-align: center;
     border: 1px solid red;
    
    }
    
    #main
    {
     
     width: 740px;
     text-align: left;
     border: 1px dashed green;
    
    }
    
    
    </style>
    </head>
    
    <body>
    
    <div id='w'>
    
    <div id='main'>Welcome</div>
    
    </div>
    
    </body>
    </html>
    Last edited by muzammil; Aug 29th, 2005 at 01:03 PM.

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Re: CSS Layout Problem In FireFox

    Was working on this very problem this afternoon.

    Code:
    <body style="text-align:center">
    <div style="margin-left: auto; margin-right: auto;width: 50em;">
       <!--Wrapper-->
         <div>Content that is align lefted</div>
    </div>
    Hopefully that works.
    Don't Rate my posts.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: CSS Layout Problem In FireFox

    You forgot to reset the text alignment in the div. Other than that, that's the correct solution.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    34

    Resolved Re: CSS Layout Problem In FireFox

    the following property was needed
    [code] margin: auto [code]

    problem is solved. Please no more posts

Posting Permissions

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



Click Here to Expand Forum to Full Width