Web Analytics Made Easy -
StatCounter CSS float question - CodingForum


No announcement yet.

CSS float question

  • Filter
  • Time
  • Show
Clear All
new posts

  • CSS float question

    I am applying a CSS style sheet to an XHTML document. I'm not really able to change the document at all (I'm designing it for someone else). My question is whether or not you can change the order in which different divs float. I'm applying a two-column format to the different divs, but I want the div that's written at the bottom of the XHTML code to be moved up in the float order. Is there any way I can change the way the divs float without changing the code? (I've tried absolute and relative positioning, but that displays strangley on different platforms or browsers).

    -- </byuhobbes>

  • #2
    Well without really seeing the code you are using there isn't much we can tell you. You can try using negative margins:
    or learn how to use absolute and relative positioning correctly.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


    • #3
      I'm not that familiar with css layout, in fact I'm converting one of pages for the first time as a learning experiment, but from what I gather, using absolute positioning is more cross-browser friendly than tables. Feel free to let me know if I'm wrong about this....
      Boston Website Design


      • #4
        The simplest example is:
        <div id="layout_wrapper">
            <div id="content">
                <!-- some content here -->
            <div id="menu">
                <!-- menu here -->
        where menu should be on the left and content on the right despite the code flow, which implies that it should be content on the left and menu on the right. Of course, there are more complicated examples, but like _Aerospace_Eng_ said, we can't help without some sort of code. For the above simple 2-column layout (which can often become "not so simple"), you would just float the menu left and content right, making sure that if you set widths, they don't mess up and make sure that your clearing element doesn't stack them.

        Originally posted by radman626
        using absolute positioning is more cross-browser friendly than tables.
        You are right about that. However, a coder must know when to use absolute positioning. Last time I noticed (though it has been about a year since I did anything with HTML/XHTML and CSS), "liquid" layouts were the thing to create. This means that most, if not ALL, of the parts of a page are scalable, possibly including fonts as one of those parts (rather than let the user control font size, scale the page with the font). Absolute positioning can make this difficult if you don't know what to do, making a user feel rather confined, or at least constrained. Liquid layouts also provide a somewhat easier way to meet accessibility guidelines.
        Last edited by rpgfan3233; Oct 11, 2006, 05:27 AM.
        PHP Code:
        $hello file_get_contents('hello.txt'); echo $hello