title: How can I get a DIV to centre on a page using jQuery and blockUI?
body: <p>I'm trying to convert Matt Berseth's '<a href="http://mattberseth.com/blog/2007/10/yui_style_yesno_confirm_dialog.html" rel="nofollow noreferrer">YUI Style Yes/No Confirm Dialog</a>' so I can use it with the jQuery blockUI plugin.</p>
  
  <p>I have to admit I'm no CSS guru but I thought this would pretty easy even for me....except 10hrs later I'm at a loss as to why I can't get the blasted thing to work. </p>
  
  <p>The problem is that I can't seem to get the 'confirmDialogue' DIV to centre on the page without some artifacts showing above it. Alternatively if I reset blockUI's CSS settings by doing....:</p>
  
  <pre><code>$.blockUI.defaults.css = {};
  </code></pre>
  
  <p>.....I find that the DIV aligns left.</p>
  
  <p>I've tried all sorts of stuff but CSS isn't my strong point being a server side app kinda guy :(</p>
  
  <p>So if anyone out there who's a jQuery/blockUI/CSS wizard reading this...please can you have a go and let me know what I'm getting wrong?</p>
  
  <p>Basically I followed the design template on Matt's blog and the HTML looks like the stuff below (the CSS is unchanged from Matt's sample). You can grab the png 'sprite' file from the complete sample project download at <a href="http://mattberseth2.com/downloads/yui_simpledialog.zip" rel="nofollow noreferrer">http://mattberseth2.com/downloads/yui_simpledialog.zip</a> - it's a .net project but I'm just trying to get this to work in a simple html file, so no .NET knowledge required.</p>
  
  <p>Anyway any advice and guidance would be really really really useful. I'll even incentivise things buy promising to buy you lashings of beer if we ever meet :)</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;script type="text/javascript" src="script/jquery-1.2.6.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="script/jquery.blockUI.js"&gt;&lt;/script&gt;
    &lt;style&gt;
    .modalpopup
    {
      font-family: arial,helvetica,clean,sans-serif;
      font-size: small;
      padding: 2px 3px;
      display: block;
      position: absolute;
    }
  
    .container
    {
      width: 300px;
      border: solid 1px #808080;
      border-width: 1px 0px;
    } 
  
    .header
    {
      background: url(img/sprite.png) repeat-x 0px -200px;  
      color: #000;  
      border-color: #808080 #808080 #ccc;
      border-style: solid;
      border-width: 0px 1px 1px;
      padding: 3px 10px;
    } 
  
    .header .msg
    {
      font-weight: bold;
    }         
  
    .body
    {
      background-color: #f2f2f2;
      border-color: #808080;
      border-style: solid;
      border-width: 0px 1px;
      padding-top: 10px;
      padding-left: 10px;
      padding-bottom: 30px;
    } 
  
    .body .msg
    {
      background: url(img/sprite.png) no-repeat 0px -1150px;  
      float: left;
      padding-left: 22px;
    }  
  
    .footer
    {
      background-color: #f2f2f2;
      border-color: #808080;
      border-style: none solid;
      border-width: 0px 1px;
      text-align:right;
      padding-bottom: 8px;
      padding-right: 8px;
    } 
  
    .close
    {
      right: 7px;  
      background: url(img/sprite.png) no-repeat 0px -300px;  
      width: 25px;  
      cursor: pointer;  
      position: absolute;  
      top: 7px;  
      height: 15px;
    }
  
    .modalBackground 
    {
      background-color:Gray;
      filter:alpha(opacity=50);
      opacity:0.5;
    }     
  
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;input id="triggerDialogue" name="triggerDialogue" type="button" value="Go" /&gt;
  
  &lt;div id="confirmDialogue" 
       class="modalpopup" style="display:none; text-align: center"&gt;
    &lt;div class="container"&gt;
      &lt;div class="header"&gt;
        &lt;span class="msg"&gt;Are you sure?&lt;/span&gt;
        &lt;a onclick="return false;" class="close" 
           href="javascript: return false;"&gt;&lt;/a&gt;
      &lt;/div&gt;
      &lt;div class="body"&gt;
        &lt;span class="msg"&gt;Do you want to continue?&lt;/span&gt;
      &lt;/div&gt;
      &lt;div class="footer"&gt;
        &lt;input type="button" id="Button1" value="Yes" style="width:40px" /&gt;
        &lt;input type="button" id="Button2" value="No" style="width:40px" /&gt;   
      &lt;/div&gt;                                                
    &lt;/div&gt;
  &lt;/div&gt;   
  
  &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
      $('#triggerDialogue').click(function() {
        $.blockUI({ message: $('#confirmDialogue') });
      });
    });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>@Owen - many thanks for that. I had to make a wee change in the .modalPopup CSS class in Matt's stylesheet to:</p>
  
  <pre><code>position: fixed;
  </code></pre>
  
  <p>....and it works. Much appreciated. I really gotta sit down with my <a href="http://oreilly.com/catalog/9780596527334/" rel="nofollow noreferrer">O'Reilly CSS book</a> which I never get a chance to read some night....:)</p>