We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28559
    • 23 Posts
    ok this question confuses even me.

    My site I have several nested divs with the inner one being called content.

    content has a border assigned to it along with a background color.

    now when I do my maxigallery call
    [!MaxiGallery? &display=`embedded` &embedtype=`slimbox` &pics_per_row=`3` &max_thumb_size=`150` &max_pic_size=`800` &thumb_use_dropshadow=`1` &thumb_use_watermark=`1` &thumb_watermark_txt=`Angelas-Art.com` &pic_use_watermark=`1` &pic_watermark_type=`image`!]


    the pictures appear to be mostly outside of the div. Then viewing the CSS using firefox web developer toolbar it shows the content div to be around the pictures. where did I screw up and what do I need to change to get this working like I’m expecting.

    here is a link to the site once I get it fixed I’ll take the link down. http://www.angelas-art.com/gallery-1.html
      • 27708 MODX Staff
      • 2,502 Posts
      SteveoSupremo,

      I would think that you had run into this before. The problem is that when you float an element in a container using CSS and divs the containing div will not grow to envelope the floated element. The solution for you (if you want to have a floated element cause the container to grow) can be achieved a number of ways using empty spans or empty divs with a property set to "clear:both;"

      What I do when it is the main body (your #content div) before the footer, I place a <hr /> (horizontal rule) before the close tag for the container and give the hr a property value set of clear:both; visibility:hidden; See the below examples using your code:

      
      <div id="content">
      <h1 align="center">Acrylic Paintings</h1>
      <p>  Angela Enjoys working with Acrylic paints here aer some of her artwork.  </p>
      <p> click on any picture to see a larger version of it.  move your mouse to the top right and top left in order to move between large pictures. </p>
      <p/>
      <p/>
      <div class="thumbscontainer">
      <ul class="thumbs">
      <li>
      <a title="title - description" rel="lightbox[maxigallery]" href="/assets/galleries/7/07-07-06_0901.jpg">
      <img class="thumbnail" alt="title » Click to zoom ->" title="title » Click to zoom ->" src="/assets/galleries/7/tn_07-07-06_0901.jpg"/>
      </a>
      <p style="width: 166px;"> title </p>
      </li>
      <li>
      </li>
      </ul>
      <!-- Place the horizontal rule element here just before the end of the #content div -->
      <hr />
      
      </div>
      <p/>
      <p> Please contact me if you want to see more pictures.  </p>
      </div>
      

      #contnent hr{
           clear:both;
           visibility:hidden;
           }
      


      This can be considered unsemantic but when displayed with the CSS off it looks okay because there will just be a horizontal rule before the footer. For me that actually adds meaning (stuff below this line is not part of the content but is site boilerplate much like the bottom margin of a book or report).

      That being said if you want to use an empty div for the same thing, go ahead. You can see an example of how this works here http://www.goldriverhomes.ca/ if you look at the source at around line 55 you will see an <hr> (I use HTML 4.01 not XHTML so you can use <hr />) and if you look at my stylesheet (http://www.goldriverhomes.ca/assets/templates/grh/_styles/common.css) you will see:

      #content_wrapper hr{
      		clear:both;
      		visibility:hidden;
      		position:relative;
      		height:0px;
      		background:#300;
          }


      I have added positioning which is not necessary but helps compatibility with some browsers. For older IE support I would suggest both adding the height of 0px and make the background color the same as your container background in case some browsers act up.

      Hope this helps.

      Jay
        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
        • 28559
        • 23 Posts
        Thanks smashingred that worked out really well.

        I think I have ran into that once before. This is only like my 3rd website and the first two were table driven or downloaded templates.

        Thanks again.
          • 27708 MODX Staff
          • 2,502 Posts
          SteveoSupremo,

          I see that you fixed it and I am glad it helped but you have another issue which is kinda poor markup. You have placed the <hr> after the gallery call but before the paragraph. If you are trying to have the paragraph clear as well you should also create a class (i.e., ".clear") assign it to any element that you want to clear floated elements and have the <hr> just before the </div>.

          <p class="clear">
          Please contact me if you want to see more pictures.
          </p>
          <hr />
          </div>
          


          .clear{
               clear:both;
               }
          


          In this case you will be able to clear the floated gallery container anyway without the hr but I would advise placing the hr in the template and not in the document. This will ensure that if you or anyone else ever floats within the document you won’t have to worry about it overlapping the #content container.

          All the best,

          Jay
            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