We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26931
    • 2,314 Posts
    Hi there,

    testsite: http://bit.ly/el8RBs

    how can i structure my markup / CSS, so that the box with the rugged-edged background PNG can expand depending on the content with another tiled background image ( http://bit.ly/gc2qTH )

    -> this is what i’m aiming at: http://bit.ly/f2Y4sH

    *basically the tiling should start (or look like), where the other background with the rugged edges ends*

    thanks, j
      • 23299
      • 1,161 Posts
      I am not sure of your issue here?
      Do you need a repeating background that will expand nicely for extra content without having a large empty empty space (with little content) when the image is too large? I think this is more of a Photoshop task? I have done this before. Check out the food menu page here: http://www.cactusrestaurants.com/menudinner.html

      I did all the design, photography and CSS for this site. It runs on Evo. That food menu was a challenge but the restaurant owner can change the menus at will.

      I created a horizontal PNG image where the top and bottom of the rough looking image as identical. This took some experimenting to ensure that the vertical tilling effect was not obvious. You have to look really closely to notice that the image is repeating. The image is not that tall but the effect still works. The top and bottom edge can be added with custom divs or utilized with a heading using the background CSS declaration.
        • 26931
        • 2,314 Posts
        thanks smiley

        the problem is, that it’s one big bg-image at the top, then the tiling (which will create a straight vertical edge) should start underneath it

        yes, this would be an option, i see how you’re using one tile for the whole container: http://www.cactusrestaurants.com/assets/templates/cactus/images/bg_menucontent.jpg

          • 26931
          • 2,314 Posts
          Photowebmax (and everyone else),

          made a testsite with a completely vertical tiled background image: http://bit.ly/dXxhjw

          the tiles are currently 300px high and got a 1px border bottom in order to distinguish them. There’s a DIV on top and on the bottom to embrace the tiled background
          ...the problem is now, that since the height varies, it will nearly be impossible to connect the bottom DIV with the tile seamlessly!? is there a trick i oversee? (remind you the rugged edges & transparent shadows)

          :) thanks, j
            • 23299
            • 1,161 Posts
            I think you are making this more complicated than it needs to be...

            This kind of page (presented in stripped down terms) could look like this:
            ...
            
            <div id="wrapper">
            <div id="content_top"></div>
            <div id="content">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
            <p>More paragaph stuff goes here. More, more more...</p>
            </div> <!--content ends-->
            <div id="content_bottom"></div>
            </div> <!--wrapper ends-->
            
            ...
            
            <!--styles-->
            
            body{
            	text-align:center}
            
            #wrapper{
            	width:960px;
            	margin: 0 auto;
            	text-align:left;}
            	
            #content_top{
            	background: url(../images/content_top.png) no-repeat top left
            	height:30px;}
            
            #content{
            	background: url(../images/content.png) repeat-y}
            
            #content p{
              	font-size: small;
            	padding: 10px 30px 10px 30px;}
            
            #content_bottom{
            	background: url(../images/content_bottom.png) no-repeat top left
            	height:50px;}


            The three images cold be created from one single image that includes your rough looking edges on all four sides. The upper image will be sliced off the top at say 30 pixels in height. The bottom could be sliced at say 50 pixels in height. The middle height is up to you. It just needs to be sliced in such a way that the upper edges are the same as the lower edges or else it wont look good when you tile it down the y-axis.

            Its best to avoid having the tiled slice be too tall as the graphic "weight" can get large, especially if you are using png-24 files. The other issue with having a tall tile is when there is very little content being used with that graphic. You might need the tile for just one sentence but if that tile is 400 pixels in height you will have a ton of empty space showing. Some users make their tile slices too thin. This makes the browser work hard to tile that slice repeatedly. Some flavors of IE can show a slight delay while doing this. Its good to pick a happy medium.

            Some purists will say that using divs just to present the upper and bottom portions of these images is a bad thing. What some will do is not have a div for the upper and lower images set specifically. You could use a headline declaration for the upper and and lower portions of this content area. You then set the CSS to add a background image to these headlines like so:
            #content h3{
            font-size:1.4em;
            font-family: "Lucida Grande", Geneva, Arial, Verdana, sans-serif;
            background: url(../images/content_top.png) no-repeat top left;
            height:30px;}
            


            The other instances for the h3 in your CSS will apply normally. Its important to realize the rules of specificity in the CSS Cascade.

            You could also stuff like <p class="upper"> and attach that upper graphic to it using the background CSS declaration. Lots of ways of doing this. What I will sometimes do is let MODx generate its natural code. I then look at some of the divs and classes that MOD generates and then add or modify the CSS accordingly. This helps reduce adding extra container divs around the MODx goodness. I see a lot of code with unneeded divs. Some snippets generate a lot of usable divs and classes to attach powerful CSS onto. Often this can be an advantageous thing.

            But adding a couple of extra divs is not a crime in my book.

            I am sure there are other ways. I rely heavily on building the right support images for the layout. I also watch the code that MODx generates and tweak the CSS to my own will. I probably do this more than most as I really lack PHP skills. But I have no problems pushing pixels around. But its amazing how flexible MODx can be in these situations...
              • 23299
              • 1,161 Posts
              What a lot of designers would naturally do here is not use a set div for that lower graphic. You could just declare that lower as the footer and and then set the background to be the lower portion of your content image...
                • 19369
                • 1,098 Posts
                Hi, I have made a screenshot.
                I am not sure if this is what you are trying to do, but this is how I would do it.


                Uploaded with ImageShack.us
                  • 19369
                  • 1,098 Posts
                  BTW, my example does not work if the background changes on the footer. If it has to change, it’s better to make the curve less prominent in this way is difficult to notice where it merges with the footer bg.
                    • 26931
                    • 2,314 Posts
                    hey microcipcip & Photowebmax,

                    thank you both so much for your time and effort helping out, i really appreciate it!! smiley

                    microcipcip, as far as i understand, your setup is pretty much like the one i made here: http://bit.ly/dXxhjw
                    while i went for a walk, i had an idea - i’ll be back - this could work laugh

                    j

                    nice Meerkat btw.!
                      • 26931
                      • 2,314 Posts
                      Heureka!

                      -> http://bit.ly/hm0ovT

                      you see, there’s a 300px high background-image at the top, then the tiling starts underneath. those PNGs still need some fine tuning, but the concept is working. had to wrap the content in a DIV, then pull it up with a negative margin smiley
                      I’m all for clean & semantic markup, but an extra DIV here & there won’t hurt, still less DIVitis as with one of the CSS frameworks.

                      thanks guys! j