We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10190
    • 187 Posts
    As Garryn made the mistake to tell me that problems regarding CSS are welcome here wink and I assume here are so many experts in templating and CSS I’d like to ask you for help on my own handmade template.

    I’ve developed it to transform the static, frame based version of http://www.karatekunst.net to modx, without the use of tables. The layout is quite simple, it consists of a header and a content area, which is devided in two columns, the left one holding only one image, the right one the text. A border should be around header and content.

    As fixed size layouts are not my favorite, I did two version, one fixed, one resizable (non-fixed). You can see them here:
    http://bischof.homelinux.net/karatekunst-table-less-fix.htm
    http://bischof.homelinux.net/karatekunst-table-less-variabel.htm
    (CSS is still inline, for debugging purposes, I will use @import later).

    Problem:
    In IE everything looks like it should. At home, with my firefox or konqueror, there are some problems:

    • The border around header and content is gone
    • With non-fixed design, text is positioned under the image, not to the right
    • If there’s less text than the image’s height, the page border is drawn under the image

    Are these problems visible for you too?

    Within modx, the body of the template looks like this:

    <BODY>
    <!--  start all content -->
    <DIV id=page>
    <!--  start header -->
     <!-- nothing here for karatekunst.net -->
    <!--  Start Menü  -->
     <DIV id=menu> 
      <!-- menue-snippet from modxcms: -->
      [[DropMenu?id=0]]
     </DIV>
    <!--  end menue  -->
    <!--  end header -->
    <!-- content -->
     <DIV id=left>
      <!-- standard image left, own TV -->
      <img width="375" height="400" src="[*image-left*]">
     </div>
     <DIV id=content>
      [*content*]
      <br />
     </DIV>
    <!-- end content -->
    </DIV>
    <!--  end all content -->
    </BODY>
    


    It think the problem should be with the CSS of the two colum-divs (#content and #left), here is the shortened style definition. If you need the complete CSS, please have a look in the source of my example links:

    <STYLE type=text/css>
    /* hier noch inline, weil's einfacher zum Debuggen ist, später:
       @import url("assets/site/karatekunst-table-less.css"); */
    
    /* Scrollbalken im Standardmode müssen im HTML-Tag definiert werden
       -> Seite ist im Standardmode, s. Doctype-Definition */
    html {
      SCROLLBAR-FACE-COLOR:#880000; 
      SCROLLBAR-HIGHLIGHT-COLOR:#880000; 
      SCROLLBAR-SHADOW-COLOR:#e7d8bf; 
      SCROLLBAR-3DLIGHT-COLOR:#e7d8bf; 
      SCROLLBAR-ARROW-COLOR:#e7d8bf; 
      SCROLLBAR-DARKSHADOW-COLOR:#880000; 
      SCROLLBAR-BASE-COLOR:#880000; 
      scrollbar-track-color:#880000;
    }
    
    BODY {
      FONT-SIZE:12px; 
      FONT-FAMILY:Verdana, Arial, Helvetica, sans-serif; 
      BACKGROUND-COLOR:#880000; 
      TEXT-ALIGN:center;
      COLOR: #e7d8bf; 
    
    /* Scrollbalken im Quirksmode gehören in den BODY-Tag, hier nicht benutzt */
      SCROLLBAR-FACE-COLOR:#880000; 
      SCROLLBAR-HIGHLIGHT-COLOR:#880000; 
      SCROLLBAR-SHADOW-COLOR:#e7d8bf; 
      SCROLLBAR-3DLIGHT-COLOR:#e7d8bf; 
      SCROLLBAR-ARROW-COLOR:#e7d8bf; 
      SCROLLBAR-DARKSHADOW-COLOR:#880000; 
      SCROLLBAR-BASE-COLOR:#880000; 
      scrollbar-track-color:#880000;
    }
    
    /* Überschriften und Text */
    H1 {
      FONT-SIZE:12px; 
      MARGIN:30px 0 0 0; 
      BACKGROUND-COLOR:#e7d8bf; 
      COLOR:#880000; 
      text-align:right; 
      padding: 2px 5px;
    }
    H2 {
      FONT-SIZE:14px; COLOR:#e7d8bf;
    }
    H3 {
      FONT-SIZE:14px; COLOR:#e7d8bf;
    }
    P {
      MARGIN-TOP:20px;
    }
    
    /* CSS für automatisch generiertes Menü */
    #menu {
      CLEAR:right; 
      PADDING-RIGHT:0px; 
      BORDER-TOP:#000000 1px solid; 
      PADDING-LEFT:0px; 
      PADDING-BOTTOM:10px; 
      COLOR:#e7d8bf; 
      PADDING-TOP:40px; 
      TEXT-ALIGN:center; 
      BACKGROUND-COLOR:#000000
    }
    
    .topnav {
        margin: 0px 0px 0px 0px;
        padding: 0px 0px 0px 0px;
    }
    
    /* linker Bereich mit Bild */
    #left {
      FLOAT:left; 
      WIDTH:376px; 
      BACKGROUND-COLOR:#880000;
      BORDER-RIGHT:none; 
      PADDING-RIGHT:0px; 
      BORDER-TOP:none; 
      PADDING-LEFT:0px; 
      PADDING-BOTTOM:0px; 
      BORDER-LEFT:none; 
      PADDING-TOP:0px; 
      BORDER-BOTTOM:none; 
      COLOR:#e7d8bf; 
    }
    
    /* rechter Textbereich */
    #content {
      BORDER-RIGHT:none; 
      PADDING-RIGHT:10px; 
      BORDER-TOP:none; 
      PADDING-LEFT:10px; 
      FLOAT:right; 
      PADDING-BOTTOM:0px; 
      BORDER-LEFT:none;  
      PADDING-TOP:0px; 
      BORDER-BOTTOM:none; 
      BACKGROUND-COLOR:#880000;
      COLOR:#e7d8bf; 
    
      /* für feste Breite (800x600) tauschen - Teil 1 */
      /* WIDTH:362px; */
    }
    
    /* Einstellung des äußersten divs */
    #page {
      border: 1px #000000 solid;
      margin: 0px auto;
      text-align:left;
    
      /* für feste Breite (800x600) tauschen - Teil 2 */
      /* width:760px; */
      width:99%;
    }
    </STYLE>
    


    Any help is greatly appreciated!
    Frisco
      • 17883
      • 1,039 Posts
      Hi Frisco,

      just add:

      overflow: hidden;

      to your #page definition. This brings the border back. And should also solve the problem with the border under your image.

      The other thing (image float) I can´t follow, because there is no image loaded here. IE sets an empty placeholder, but FF doesn´t because there is no image - FF never shows an image which is not present:

       <img width="375" height="400" src="">


      Gruß Marc wink
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        This is one of my favorites:

        http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/

        OSWD has hundreds of free templates, one of them is bound to suit. Why waste your time and energy re-inventing the wheel?

        http://www.oswd.org/
          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
          • 10190
          • 187 Posts
          Quote from: MadeMyDay at Mar 17, 2006, 05:36 AM

          Hi Frisco,

          just add:

          overflow: hidden;

          to your #page definition. This brings the border back. And should also solve the problem with the border under your image.

          The other thing (image float) I can´t follow, because there is no image loaded here. IE sets an empty placeholder, but FF doesn´t because there is no image - FF never shows an image which is not present:

           <img width="375" height="400" src="">


          Gruß Marc wink

          Hi Marc,

          you’re right, borders are back. Thanks for the hint with the image placeholder in FF, I didn’t know that and will put an image for tests there. But I have implemented it in modx as well, an attached an image, you can probably see the problem there:

          http://bischof.homelinux.net/modx/lehrer.html

          There seems to be another problem with the variable layout as well, the text starts without padding at the left border of the image, which shouldn’t be - how’s that?

          Thanks for helping,
          Frisco

            • 17883
            • 1,039 Posts
            Well, obviously the padding is set to the left border and not to the image. The image lets the text float around, but the padding only belongs to the left border (as you can see when your text gets longer, there is a padding-left under the image) of the content DIV.

            Suggestion: Put a margin-right to the #left DIV (and add display: inline; because of a IE float-bug)

            margin-right: 10px;
            display: inline;


            But you have to test it in IE, just can control FF with preview.

            Gruß Marc

              • 10190
              • 187 Posts
              Quote from: MadeMyDay at Mar 17, 2006, 06:21 AM

              Well, obviously the padding is set to the left border and not to the image. The image lets the text float around, but the padding only belongs to the left border (as you can see when your text gets longer, there is a padding-left under the image) of the content DIV.

              Suggestion: Put a margin-right to the #left DIV (and add display: inline; because of a IE float-bug)

              margin-right: 10px;
              display: inline;


              But you have to test it in IE, just can control FF with preview.

              Hi Marc,

              thanks, I’ll test it and report afterwards - I have some meetings this afternoon, thus it will take some time for me. This browser testing/fixing is really time consuming sad

              Thanks again!
              Frisco
                • 10190
                • 187 Posts
                Quote from: sottwell at Mar 17, 2006, 05:41 AM

                This is one of my favorites:

                http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/

                OSWD has hundreds of free templates, one of them is bound to suit. Why waste your time and energy re-inventing the wheel?

                http://www.oswd.org/

                Hi Susan,

                thanks for the links, I didn’t know them - but I think I’ll like them alot!

                I don’t like re-inventing the wheel as well, but I wanted to learn CSS. As a matter of fact, I took two designs from http://www.css4you.de and merged them and added s.th. own, but now I’m running into the problems I mentioned above - and I like to _understand_ how to solve them, thus not having the need to bore people with my questions again smiley

                Have a nice weekend,
                Frisco
                  • 10190
                  • 187 Posts
                  Quote from: MadeMyDay at Mar 17, 2006, 06:21 AM

                  Well, obviously the padding is set to the left border and not to the image. The image lets the text float around, but the padding only belongs to the left border (as you can see when your text gets longer, there is a padding-left under the image) of the content DIV.

                  Suggestion: Put a margin-right to the #left DIV (and add display: inline; because of a IE float-bug)

                  margin-right: 10px;
                  display: inline;


                  Hi Marc,

                  does that work for you? For me not, as the h1 still touches the image, and text still floats under the image if its long enough. I still don’t understand why I should apply a margin to the #left - I have a padding-left:10px for #content, so it should have 10px to the image.

                  You write that the image lets the text float around, but shouldn’t the #left let the text float around?

                  With the fixed design the right content works fine, maybe the problem is the missing width= attribute at #content?

                  I added an image so that it is visible in FF now as well, and I’ve colored the divs, so that one can see what belongs to what.

                  Any further suggestions?
                  Frisco
                    • 17883
                    • 1,039 Posts
                    Hi Frisco,

                    of course the text will float around the image because the #left DIV is just as high as the image. Try this for your content DIV:


                    margin-left:376px;
                    padding-left: 10px;

                      • 10190
                      • 187 Posts
                      Quote from: MadeMyDay at Mar 17, 2006, 03:03 PM

                      Hi Frisco,

                      of course the text will float around the image because the #left DIV is just as high as the image. Try this for your content DIV:


                      margin-left:376px;
                      padding-left: 10px;
                      Hi MadeMyDay,

                      I’ve tried this, but it didn’t work properly. Following Susans link, reading the tutorials and following even more links there, I read:
                      http://www.alistapart.com/articles/negativemargins/
                      about negative margins.

                      That did it!

                      I had to add an div#container around the #content, gave it a negative margin of -386px, and add a positive margin of 386px to #content.

                      I’m not quite sure why this container is necessary or why it didn’t work without, like you suggested - but anyway, now it works for non-fixed layouts, of which I think that they are far more difficult to realize than fixed ones.

                      But I learned a lot about css and tricks like negative margins, tiled background images and more, so thanks alot again!

                      Ah, one can see the final layout here, with colored divs for easier understanding (althouth the container is not coloured, as it lays on top of the image and would make it invisible than.

                      http://bischof.homelinux.net/karatekunst-test-variabel.htm

                      But try the Webdeveloper Toolbar in FF, Outline:Outline Block Level Elements to see it. This toolbar is really great!!!

                      Frisco