Results 1 to 2 of 2

Thread: Fix Floating Elements

  1. #1
    Join Date
    Mar 2010
    Location
    Florida
    Posts
    512
    Thanks
    9
    Thanked 61 Times in 59 Posts

    Default Fix Floating Elements

    So I am testing something to center elements in a UL. However, if I try to push one end using
    Code:
    left:50%; transform:translateX(-50%);
    and squeeze the page it seems to not want to stay all on one line.

    Here is an example:
    http://thebcelements.com/GCG/
    -DW [Deadweight]
    Resolving your thread: First Post: => EDIT => Lower right: => GO ADVANCED => Top Advance Editor drop down: => PREFIX:Resolved

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    To center li elements, declare text-align:center; on the ul, and set the li elements as display:inline-block; instead http://jsbin.com/yageduruqu/edit?html,css,output

    There is a gap around inline-block elements though so, to counteract it, you can bunch up the markup so that the li tags sit together on one line, or comment out the new-line between them (demo does the latter)
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Replies: 2
    Last Post: 08-17-2010, 03:22 AM
  2. Adding Elements to Arrays - elements lost
    By Henamot in forum Flash
    Replies: 0
    Last Post: 03-19-2009, 10:30 AM
  3. Getting all the <li> elements
    By Moshambi in forum JavaScript
    Replies: 4
    Last Post: 11-06-2008, 08:03 PM
  4. Replies: 8
    Last Post: 04-29-2008, 03:34 PM
  5. Floating Image : determine floating area
    By Xeus in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 01-13-2008, 02:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •