Professional Web Applications Themes

Center a div tag - Macromedia Dreamweaver

Hi The following div tag displays with a border. However, I want it to display center on the page. Any ideas welcome thanks jim <div align="center" style=" width: 70%; border: 2px solid #4f7295 ">test</div>...

  1. #1

    Default Center a div tag

    Hi

    The following div tag displays with a border. However, I want it to display center on the page.

    Any ideas welcome
    thanks

    jim

    <div align="center" style=" width: 70%; border: 2px solid #4f7295 ">test</div>


    rockhiker Guest

  2. #2

    Default Re: Center a div tag


    <div style="margin: 0 15%;">
    <div style="border: 2px solid #4f7295 ">test</div>
    </div>

    --
    Al Sparber - PVII
    [url]http://www.projectseven.com[/url]
    Dreamweaver Extensions - DesignPacks - Tutorials - Books
    ---------------------------------------------------------------------
    The PVII Newsgroup | [url]news://forums.projectseven.com/pviiwebdev[/url]
    The CSS Newsgroup | [url]news://forums.projectseven.com/css[/url]
    ---------------------------------------------------------------------




    Al Sparber- PVII Guest

  3. #3

    Default Re: Center a div tag

    Thanks. It worked.

    I'll try Al's method also.

    jim


    rockhiker Guest

  4. #4

    Default Re: Center a div tag

    Thanks for the reply.

    It worked. Why is the bluerobot method unstable?


    rockhiker Guest

  5. #5

    Default Re: Center a div tag

    >Hi Ben,
    >The method I gave will work fine in IE5x on PC. Based on the original
    poster's code, we are dealing with a static DIV. The bluerobot techniques
    are rather unstable, in my opinion.

    Al

    I don't quite understand the Bluerobot.com claim(s) about MSIE5.x/Win and so if you could further explain why it is unstable I'd really appreciate it.

    Your method (using static DIV) works without any problems? Is the other method only for 'position: absolute;'? So if I'm using a '%' as the width is it better to use the method you described? What if I'm declaring a specific 'width' as opposed to a '%' for that value?

    Thanks for any input.


    Bridgetown Ben webforumsuser@macromedia.com Guest

  6. #6

    Default Re: Center a div tag

    I think bluerobot's method is longer, which may be prone to error, hence
    Al's comment. But with that said, the bluerobot method works well
    when you want your div a fixed width and centered, whereas Al's more
    standard method would leave the div as variable at 70% of the page width.

    Different methods for different goals, that's all. Al's method doesn't
    need to be hacked, whereas bluerobot uses a simple hack to make the div
    center up correctly for IE5.5.

    - Josh

    Josh Guest

Similar Threads

  1. how to center webpage
    By rocker00 in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: September 17th, 04:55 PM
  2. <center>
    By jrc in forum Web Design
    Replies: 3
    Last Post: September 10th, 10:20 PM
  3. How is KEH Repair center !!
    By Matt Clara in forum Photography
    Replies: 3
    Last Post: July 15th, 06:44 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139