Ask a Question related to Macromedia Dreamweaver, Design and Development.

  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. Similar Questions and Discussions

    1. How to center a layer ?
      Hello friends.. I have created a pop up menu with a tool that creates de code in Javascript. The I have setted it on a layer (if I do not do it, the...
    2. Center Backgroundimge II
      I fought it was fixed, but it ain't. I had problems with centering the background image and user told me to use CSS: No, not as a page...
    3. is it possible to center a text?
      Is it possible to center a text in flash? I have already expose the problem in other forum and I discover we can use css. The problem is those css...
    4. <center>
      Is there a way to use the html code fragment to insert <center> </center> to center the page. It's a pain to redo it every time you update all the...
    5. How is KEH Repair center !!
      "Steve Merrick" <steve@keh.com> wrote in message news:3f1eba74.0306251424.4f80088f@posting.google.com......
  3. #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

  4. #3

    Default Re: Center a div tag

    Thanks. It worked.

    I'll try Al's method also.

    jim


    rockhiker Guest

  5. #4

    Default Re: Center a div tag

    Thanks for the reply.

    It worked. Why is the bluerobot method unstable?


    rockhiker Guest

  6. #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

  7. #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

Posting Permissions

  • You may not post new threads
  • You may 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