www.webdeveloper.com
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2012
    Posts
    4

    Centering in a div

    The flash file in the <content> div area of iprezence.com/paintshop/indexTest.htm is being offset from the left margin and the right end extends off the conrent area. The flash file should fit the page width. Can someone point out what I need to do to fix this?

  2. #2
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    190
    You can use a simple trick to centre a <div> like so:

    Code:
    #your_div
    {
        margin-right: auto;
        margin-left: auto;
    }
    That will give automatic margins to both sides, centring the element. You might also be able to use the text-align property in CSS to align the contents to the centre:

    Code:
    #your_div
    {
        text-align: center;
    }

  3. #3
    Join Date
    Feb 2012
    Posts
    4
    Thanks, that worked. But now the menu buttons are offset from the left margin and are truncated on the right. I can't seem to find the source of the css that is causing it. Any help is appreciated.

Thread Information

Users Browsing this Thread

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

     

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
HTML5 Development Center



Recent Articles