TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-20-2008, 12:49 AM   #1 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 254
Thanks: 39
sarmenhb is on a distinguished road
Default floating list elements

hello,

when i float a list to the right, their order is reversed why is that?

for example if i have a list that is like this inside of a div element.

<ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>

when i try to float it to the right (instead of showing it as first,second,third, it shows it as third,second,first.

anyone know why it is? anything i have to do?
__________________
http://www.sarmenhb.com
Send a message via AIM to sarmenhb Send a message via MSN to sarmenhb Send a message via Yahoo to sarmenhb Send a message via Skype™ to sarmenhb
sarmenhb is offline  
Reply With Quote
Old 09-20-2008, 01:59 AM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,578
Thanks: 72
Wildhoney is on a distinguished road
Default

html4strict Code:
<html>
<head>

<style type="text/css">

    div
    {
        border: 1px solid red;
        width: 200px;
        overflow: hidden;

    }

    div ul
    {
        border: 1px solid blue;
        float: right;
        overflow: hidden;
    }

    div ul li
    {
        border: 1px solid green;
        float: left;
        overflow: hidden;
        width: 50px;
    }

</style>

</head>
<body>

<div>
    <ul>
        <li>First</li>
        <li>Second</li>
        <li>Third</li>
    </ul>
</div> 

</body>
</html>

Like that?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 09-20-2008, 06:13 AM   #3 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 254
Thanks: 39
sarmenhb is on a distinguished road
Default

change the div ul li to float right and u'll see how it changes the order.

Code:
    div ul li
    {
        border: 1px solid green;
        float: right;
        overflow: hidden;
        width: 50px;
    }
__________________
http://www.sarmenhb.com
Send a message via AIM to sarmenhb Send a message via MSN to sarmenhb Send a message via Yahoo to sarmenhb Send a message via Skype™ to sarmenhb
sarmenhb is offline  
Reply With Quote
Old 09-20-2008, 09:32 AM   #4 (permalink)
The Wanderer
Good Samaritan 
 
martins256's Avatar
 
Join Date: Mar 2008
Posts: 15
Thanks: 0
martins256 is on a distinguished road
Default

I made you some samples :)

right
center
left
martins256 is offline  
Reply With Quote
The Following User Says Thank You to martins256 For This Useful Post:
Wildhoney (09-21-2008)
Old 09-20-2008, 12:19 PM   #5 (permalink)
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 218
Thanks: 16
RobertK is on a distinguished road
Default

Sarmen, the reason the order is reversed is that you float each element and not the list itself. So take each item from the top of the list down and float it right: you get what you have. Item 1 becomes 3, and 3 becomes 1.

The given examples show you a good way to float it on the right without reordering the list.
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:39 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0