Activity Stream
48,167 MEMBERS
6853 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Member

    Default Center webpage with absolute positions?

    I've googled and googled, nothings worked. I'm normally pretty wizzy with coding. But for some odd reason, I can't position this webpage center because it has absolute position with percentage used. I've done it before, cant remember how tho?

    Here's the css code:
    Code: 
    
    body { background: #000000;   }
    
    
    
    .top-nav {
    background-image: url('./images/topstrip.png');
    background-position:center;
    background-repeat:no-repeat;
    position:absolute;
    width:1152px;
    height:93px;
    z-index:3;
    }
    
    
    .dscratch {
    top:10%;
    left:1.7%;
    position:absolute;
    z-index:3;
    }
    
    
    
    
    #navcontainer ul li { display: inline; }
    
    #navcontainer ul li a
    {
    padding: 0.9em 0.01em;
    color: White;
    text-decoration: none;
    float: right;
    
    
    }
    
    #navcontainer ul li a:hover
    {
    background-image: url('./images/active.hover.png');
    background-repeat:no-repeat;
    background-position:center;
    
    color: #fff;
    }
    
    
    .blackbox {
    background-image: url('./images/topblock.png');
    background-repeat:no-repeat;
    position:absolute;
    width:1152px;
    height:376px;
    z-index:99;
    top:10.5%;
    }
    
    .logo {
    left:2%;
    position:absolute;
    top:5%;
    z-index:100;
    }
    
    .designs {
    left:2%;
    position:absolute;
    top:50%;
    z-index:101;
    }
    
    .recentworks{
    background-image: url('./images/recent_work.png');
    background-repeat:no-repeat;
    width:auto;
    height:auto;
    top:15%;
    left:45%;
    position:absolute;
    z-index:102;
    }
    
    .bodybg {
    position:absolute;
    z-index:1;
    }
    
    .portfolioimg {
    left:0.5%;
    position:absolute;
    top:50.5%;
    z-index:105;
    border:0;
    }
    
    
    .supportimg {
    left:3%;
    position:absolute;
    top:66%;
    z-index:106;
    border:0;
    }
    
    .point2 {
    left:32.5%;
    position:absolute;
    top:68%;
    z-index:106;
    border:0;
    }
    
    .point3 {
    left:58%;
    position:absolute;
    top:66.5%;
    z-index:106;
    border:0;
    }
    
    .footer {
    background:#a0a0a0 url('./images/footer.png');
    bottom:0;
    left:0.6%;
    top:121%;
    display:block;
    height:49px;
    position:absolute;
    float:bottom;
    text-align:right;
    vertical-align:baseline;
    width:1152px;
    z-index:115;
    }
    
    .overview {
    position:absolute;
    left:3%;
    top:98.8%;
    z-index:120;
    }
    
    .homecontent {
    position:absolute;
    left:16.5%;
    top:95%;
    width:790px;
    height:219px;
    z-index:120;
    }
    
    
    .footerguy {
    position:absolute;
    left:74.3%;
    top:97%;
    z-index:122;
    }
    iL < Reviewed by iL < on . Center webpage with absolute positions? I've googled and googled, nothings worked. I'm normally pretty wizzy with coding. But for some odd reason, I can't position this webpage center because it has absolute position with percentage used. I've done it before, cant remember how tho? Here's the css code: body { background: #000000; } .top-nav { Rating: 5
    MSN: [email protected]
    Skype: lesdog123

    PSD 2 XHTML/CSS service.
    PHP, jQuery, Java, MySQL service.
    Previously employed at Sympact and Strem Art Design.

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    Rapidleech.com FullMaza.com WarezOcean.com MediaFireForum.com
    Try to add center code in body..

  4.     
    #3
    Respected Member
    You have a container for your navigation hwoever you need an overall "container" div to put everthing inside and you can position that div and things inside will follow it.
    "Maybe this world is another planet's Hell"

  5.     
    #4
    Member
    Another odd thing,
    it only makes div's that have backgrounds,

    e.g
    Code: 
    .blackbox {
    background-image: url('./images/topblock.png');
    background-repeat:no-repeat;
    position:absolute;
    width:1152px;
    height:376px;
    z-index:99;
    top:10.5%;
    and that html for that is e.g
    Code: 
    <dov class="class">
    <div class="class2"><img src=" "></div>
    </div>
    it will only position the div with backgrounds,
    MSN: [email protected]
    Skype: lesdog123

    PSD 2 XHTML/CSS service.
    PHP, jQuery, Java, MySQL service.
    Previously employed at Sympact and Strem Art Design.

  6.     
    #5
    Member
    A link to the page would help.

    as Loget said make a main container & add

    margin-left:auto;margin-right:auto;

  7.     
    #6
    Member
    MSN: [email protected]
    Skype: lesdog123

    PSD 2 XHTML/CSS service.
    PHP, jQuery, Java, MySQL service.
    Previously employed at Sympact and Strem Art Design.

  8.     
    #7
    Member
    Website's:
    proxxy.in scnpic.com w7s.org
    the simplest code is

    PHP Code: 
    .main-background
    {
      
    margin0 auto;
      
    padding0;
      
    background-color#DBE5EB;
      
    background-imageurl('images/page_t.jpg');
      
    background-repeatno-repeat;
      
    background-attachmentfixed;
      
    background-positiontop center;
      
    font-familyArialHelveticaSans-Serif;
      
    font-stylenormal;
      
    font-weightnormal;
      
    font-size12px;
      
    color#40535E;

    this is what i use for image backgrounds


  9.     
    #8
    Member
    yeah, i don't have any help needed for the background codes tho..
    or are you telling me to use background codes for all images instead of

    <div class="class">
    <img src="img">
    </div> etc.. ?
    MSN: [email protected]
    Skype: lesdog123

    PSD 2 XHTML/CSS service.
    PHP, jQuery, Java, MySQL service.
    Previously employed at Sympact and Strem Art Design.

  10.     
    #9
    Member
    Website's:
    proxxy.in scnpic.com w7s.org
    use background codes for all images, background/sheet/header then use <div class="class"><div>

    its a bit cleaner and will validate your css


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Absolute url Vs Relative url.
    By GBot in forum Whitehat SEO
    Replies: 0
    Last Post: 20th Dec 2013, 11:00 AM
  2. How do i align my webpage to the center?
    By dtommy79 in forum Web Development Area
    Replies: 6
    Last Post: 11th Jul 2011, 01:00 PM
  3. [Buying] Ad Positions
    By netrun123 in forum Completed Transactions
    Replies: 4
    Last Post: 15th Jan 2011, 10:50 AM
  4. [Shared] Absolute Free Offshore Hosting (3 Months)
    By r@liablehost in forum Archive
    Replies: 14
    Last Post: 28th Sep 2010, 05:56 PM
  5. Whatever Happened to the Mod Positions
    By robo-cop in forum Feedback and Suggestions
    Replies: 7
    Last Post: 10th Aug 2008, 05:55 AM

Tags for this Thread

BE SOCIAL