We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    http://symphonicheaven.com/gallery/

    I’m trying to edit the default template to work w/ my website. The original script didn’t include a background for the "images" area, so I’m having to edit it to get one to work, since I have a patterned background.

    I have a DIV-layer wrapped around it, but the ul/li stuff isn’t wanting to stay put inside of the DIV. I found out it comes from here...

    #gallery ul.thumbs li {
    	margin:0 15px 10px 0;
    	display:block;
    	float:left;
    }


    Namely the float:left. Now, if I remove that, it works as expected, but looks like a normal unordered list. I can’t do a height on the "wrapping" DIV layer, because there might be too many images. What can I do?
      My Snippets
      -> PopUpChunk v1.0
      • 13577
      • 302 Posts
      You might try adding a float:left to the wrapper-

      #wrapper {
          background-color:#EEEEEE;
          border:2px solid #000000;
          padding:10px;
          width:925px;
          float:left;
      }
      

      It seems that when a containing div is also floated, the floated stuff inside it expands the parents bounds. I’m sure you could Google that for a more concise explanation.
        Standard Disclaimer
        I could be totally wrong.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You can also add an element to the bottom of the container with "clear: both" and it will force the container to expand. I know, that’s an extra unnecessary set of tags, but sometimes floating the container is not an option.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 28033
          • 925 Posts
          I’ll try those ideas and see if they work. smiley

          EDIT: jaredc’s trick worked. *notes that down mentally for future use*

          I spend a half-hour trying to debug it, and he fixes it in a second. tongue
            My Snippets
            -> PopUpChunk v1.0
            • 28033
            • 925 Posts
            http://symphonicheaven.com/gallery/index.php?file=/Events

            Another issues I noticed. I didn’t see the point in creating a new post just for this.

            Anyone know what htaccess rule I would use to omit the index.php?file=/ stuff, and just have a link like http://symphonicheaven.com/gallery/Events/ work? That stuff confuses me when doing stuff like that. x_x
              My Snippets
              -> PopUpChunk v1.0
              • 23299
              • 1,161 Posts
              If you want to learn more about positioning and floats etc then read "CSS Mastery: Advanced Web Design Solutions" by Andy Budd. The best chapter is Chapter Seven...

              Max
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Or if you’re like me and too cheap to buy books, there’s A List Apart and Postion is Everything for some terrific articles and tutorials. Also http://reference.sitepoint.com/css is a good bookmark to have.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 27708 MODX Staff
                  • 2,502 Posts
                  Quote from: sottwell at Mar 21, 2008, 12:23 PM

                  You can also add an element to the bottom of the container with "clear: both" and it will force the container to expand. I know, that’s an extra unnecessary set of tags, but sometimes floating the container is not an option.

                  I was going to recommend two methods including my old way and the PIE Clearfix but guess what! There is a Doh! solution for clearing floats that most CSS designers (myself included) have never tried at Sitepoint--it is so simple it makes you want to scream. AHHHHHHHHHHH!

                  This is the one I used to use which is to place an <hr /> element after the last float and then give it the following CSS style:
                  #container hr{
                      clear:both;
                      height:0;
                      visibility:hidden;
                      display:none;
                  }
                  



                  Here is the "new" way from SitePoint:
                  #container {
                      overflow:auto;
                  }


                  How simple is that?


                    Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                    • 33372
                    • 1,611 Posts
                    Even a simple <br clear="all" /> will clear floated content for you. Basically floats are considered outside the rest of the layout, and clearing them is like using carriage return on those old electric typewriters so that you can start fresh on the next line below. The rules for exactly how floated elements behave seem simple when you read them, but in practice I’ve found them to be rather unpredictable.

                    Like many designers, I used to float all sorts of layout elements because it seemed to be an almost magical solution for easily laying out a page. But now I try to only use floats where they’re needed (ul menus, etc.) and not for layout. I found that using absolute positioning avoids the float issues I kept seeing and makes search engine optimization easier (e.g., content before menus).

                    Floats in the layout seem to slow down page display as well. The browser has to calculate the dimensions and behavior of the contained content before it can render the float in its proper location, and especially on slow machines or connections this can make a noticeable difference in load time. Firefox in particular seems to sporadically panic during this process and just spit out a float as if there were a clear:both above it (for example dumping your floated right column content below the left one).
                      "Things are not what they appear to be; nor are they otherwise." - Buddha

                      "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                      • 5091
                      • 332 Posts
                      Quote from: smashingred at Mar 22, 2008, 09:47 AM

                      Here is the "new" way from SitePoint:
                      #container {
                          overflow:auto;
                      }


                      How simple is that?

                      I read that article too. The method is GREAT but it doesn’t always work, I can’t remember exactly what it was, but I stumbled twice with layouts that overflow: auto doesn’t do the trick.