The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Development
  • Client Side
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Development
 Client Side

  • flashkicks Author 
    • 1850 
    • 0 
    • 3 
    Easiest way to centre a floated list?
    uxte

    Last reply Nov 22 2008, 03:58 PM

    by uxte

    Posted: Nov 20 2008, 06:09 AM

    by flashkicks

     

So I am creating a footer navigation that I want to appear centered inside its containing div. The problem is that it’s a horizontal navigation so the anchor tags are blocks and floated left. The way I have solved it right now is to add left padding to the <ul> tag to push the list elements (of which there are five) to the centre. The problem is that the site will eventually be developed by someone else (who isn’t necessarily as knowledgeable on css), so when they add more links it will no longer be centered.

What is the easiest way to go about solving this?

  3 REPLIES
 
David_King
1  
David_King

If you’re not arsed about having all the links equal width, try “inline” styling:

[HTML]<ul id=“footer”>
 

  • link one
  •  

  • link 2
  •  

  • link three
  •  

  • link four
  • </ul>[/HTML]

    ul#footer {list-style-type: none; margin: 0; text-align: center;}
    ul#footer li {display: inline; padding: 0 5px;} 

    Something like that (off the top of my head)

    • 20 November 2008 11:36 AM
    •  
    flashkicks Author 
    2  
    flashkicks

    Thanks, but this doesn’t work. The links just go back to being at the left.

    • 21 November 2008 07:06 PM
    •  
    uxte
    3  
    uxte

    Here you have wink

    *{padding:0; margin:0}

    body{text
    -align:center}

    #wrap{width:850px; margin:0 auto 0 auto}

    #footer {width:100%; border:red 6px solid}

    ul#footer-nav{list-style-type:none; border:green 6px solid}
    ul#footer-nav li{margin:10px; display:inline; border:gray 6px solid} 
    <div id="wrap">
        <
    div id="footer">
            <
    ul id="footer-nav">
                <
    li><a href="#" title="link 1">link 1</a></li>
                <
    li><a href="#" title="link 2">link 2</a></li>
                <
    li><a href="#" title="link 3">link 3</a></li>
                <
    li><a href="#" title="link 4">link 4</a></li>
                <
    li><a href="#" title="link 5">link 5</a></li>
            </
    ul>
        </
    div>
    </
    div> 
    • 22 November 2008 03:58 PM
    •  
    •   Log in or join for free to make a comment.
     
    Topic actions
    •  Share on Facebook
    •  Share on Twitter
    Topic Categories
    •  Show All Topics
    •  Development
      •  Server Side
      •  Client Side
    •  Creative Software
      •  Web
      •  Video
      •  3D
      •  Illustrator
      •  Photoshop Battles
      •  Photoshop
    •  Design
      •  Typography
      •  Resources & Insight
      •  Checkpoint
    •  Career
      •  Copyright Matters
      •  Advice & issues
      •  Job Seekers
      •  Job Offers
    •  Flash
      •  UltraMath
      •  OOP
      •  Third Party Tools
      •  Open Source alternatives
      •  Data Communication
      •  Components
      •  Flex
      •  AIR
      •  Flash Lite
      •  Flash Professional
      •  Flash Newbie
      •  ActionScript
      •  XML
    •  Lounge
      •  Polls
      •  Random Chat
      •  Showcase And Critique
      •  BombShock Award Nominations
    •  Community Essentials
      •  BombShock Award Winners
      •  Tutorials
      •  Interviews
      •  News
      •  Bitmap tutorials
    Popular Topics
    • Sort by: 
    • Activity
    • Views
    • Comments
    • Likes
    Advertise with us
    • Your advertisement here!
    • loading
    Ultrashock
    • Creative Assets
    • Community
    • Blog
    1. Home
    2. Forum
    +/-
    Creative Assets
    • Categories
    • Contributors
    • How to buy
    Make Money
    • Commission Rates
    • Referral Program
    • Contributor Program
    Community
    • Activity Feed
    • Forum
    • Profiles
    About
    • Quick Tour
    • Our History
    • Banners & Logos
    Support
    • Contact Ultrashock
    • Advertise with us
    • Legal Information
    •  Keep up to date
    • Flash 775  Flash
    • Audio 6,481  Audio
    • Vector 2,130  Vectors
    • Image 12,338  Images
    • Creative Assets 21,724  Assets
    • Profiles 282,659  Members
    • Topics 93,762  Topics
    • Blog 4  Blog
    • Facebook 1,680  Facebook
    • Twitter 1,165  Twitter
    • Join our FREE monthly newsletter!
    • Archive
    • Invalid email address. Please try again.
    Subscribe
    • ©2012 Ultrashock LLC - All rights reserved
    • Terms of Use
    • Privacy Policy
    • Switch to dark theme
    • RSS Feeds
    • Top

    ©2012 Ultrashock LLC - All rights reserved

    Printed on Sat, February 04, 2012 - 19:40:03