CSS positioning

Discussion in 'CSS' started by candychip, Aug 7, 2008.

  1. #1
    hi,

    1) > I have a div tag which is to be displayed on top of my page in centre horizontally and vertically.

    2) >> and even if user uses scrollbar that div tags remain in centre

    please help

    3) >> can we create semi transparent div tag that background page is also visible

    regards
     
    candychip, Aug 7, 2008 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    To center a div horizontally, use margin: 0 auto;

    To keep it centered vertically when the user scrolls, I think you can only do that with Javascript.

    For transparency, use:
    filter:alpha(opacity=60); /* for IE */
    opacity:0.6; /* CSS3 standard */

    You can see it working at W3Schools - Transparency
     
    Cash Nebula, Aug 11, 2008 IP
  3. Nxiel

    Nxiel Peon

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If its aligned vertically in the middle as well, then you are probably using absolute positioning. You will have to make the container in which your current div is in relative.

    If you just want to align something in the middle use margin: 0 auto;. Onething to note is that your content type will affect whether this property works in IE6 or not.
     
    Nxiel, Aug 11, 2008 IP