www.webdeveloper.com
Results 1 to 3 of 3

Thread: div to float to the center of the screen

  1. #1
    Join Date
    Jun 2009
    Posts
    23

    div to float to the center of the screen

    Hi,

    I would like to have a <div> always be in the middle of the screen even when the page is scrolled. Anyways to do this with HTML/javascript/css ?

    Thank you.

  2. #2
    Join Date
    Mar 2011
    Posts
    1,138
    You'll need JavaScript to keep an element visible all the time. Search on "javascript fixed position" and you should find some examples.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Oct 2012
    Location
    /dev/null
    Posts
    15
    try this code:

    .div_watchedit{
    position:absolute;
    visibility:visible;
    width:735px; /* enter your width */
    height:381px; /* enter your height*/
    margin: auto;
    z-index:10;
    background:#fff;
    top:50%;
    left:50%;

    }

Thread Information

Users Browsing this Thread

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

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