why is my code different in different browsers?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mariko
    New Member
    • Mar 2010
    • 23

    why is my code different in different browsers?

    I know that there are different margins in different browsers. I tried the Global Reset and it didn't help. I am a beginner, so I might be doing something wrong and I won't be offended if you criticize me!

    In my code, I have two panels. One is for images and it is 350 pixels wide on the left side. Let's call it "imagepanel ". On the right, I have descriptions of the images. The descriptions are, obviously, text. To separate the text describing one picture from the text describing another picture, I have <br />'s. And these seem to be the problem. The descriptions in Mozilla Firefox line up nicely. In the (dreadful) IE and in Google Chrome there seem to be fewer <br />'s. Why? And how do I fix it? Thanks!
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Without a link, or the complete markup, anything would be just a wild guess.

    Comment

    • mariko
      New Member
      • Mar 2010
      • 23

      #3
      Code:
      <!DOCTYPE html PUBLIC "_//W3C//DTD XHTML 1.o Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <link rel="stylesheet" href="http://bytes.com/images/style.css" type="text/css" />
      <title>Herbergers' Furniture Company</title>
      </head>
      <body>
      <div id="page" align="center">
      <div id="content" style="width:800px">
      <div id="banner">
      <div style="margin-top:30px" class="whitetitle">
      </div>
      </div>
      <div id="menu">
      <div align="right" class="smallwhitetext" style="padding:9px;">
      <a href="index.html">Home</a> | <a href="furniture.html">Furniture</a> | <a href="about.html">About Us</a>  |  <a href="news.html">News</a> | <a href="contact.html">Contact Us</a>
      </div>
      <div id="panelbyimages" style="padding:10px">
      <br />
      <div class="titletext">Decorations</div>
      <br />
      <div class="titletext" style="padding:30px;" align="justify">
      Acorn Birdfeeder
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" style="padding:30px;" align="justify">
      Desert Clock
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Farm Rooster
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Full Harvest
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Love
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Nostalgia
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Prize Fish
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Raised Bowl Centerpiece
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Southern Pattern Boards
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      Syled Shelves
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimensions:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <div class="titletext" align="justify">
      The Land Of Coffee
      <br />
      <br />
      <div class="titletextTwo" align="justify">
      Description:
      <br />
      Dimension:
      <br />
      Wood Type:
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      <div id="imagepanel" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/acorn_.jpeg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/desertClock.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/farmRooster.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/FullHarvest.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/Love.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/Nostalgia.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/PrizeFish.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/RaisedBowlCenterpiece.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/southernpatternboards.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/StyledShelves.jpg" align="justify">
      <br />
      <br />
      <br />
      <br />
      <img src="http://bytes.com/images/decorations/TheLandOfCoffee.jpg" align="justify">
      <br />
      <br />
      <br />
      <div align="center">
      <div id="woodsubpanel">
      <div id="footer" class="smallgraytext" align="center">
      <a href="index.html">Home</a> |  <a href="furniture.html">Furniture</a> |  <a href="about.html">About Us</a> | <a href="news.html">News</a> | <a href="contact.html">Contact Us</a>
      </div>
      </div>
      <script type="text/javascript">
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
      try{
      var pageTracker = _gat._getTracker("UA-xxxxxx-x");
      pageTracker._trackPageview();
      } catch(err) {}</script>
      </body>
      </html>
      Last edited by numberwhun; Mar 24 '10, 08:41 PM. Reason: Please use CODE tags!!!

      Comment

      • mariko
        New Member
        • Mar 2010
        • 23

        #4
        It sucks but there it is. Do you need CSS?

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          Yes, need the CSS. Also, surround your mark up with code tags: [ code ][ /code ] without the spaces between the brackets.

          EDIT: Hold off on the CSS. I want to show you something first.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            There are a couple ways of listing the items on the page. Here's one I threw together:
            Code:
            <style>
            h1{text-align:center}
            div{width:600px;height:100px;margin:0 auto;border:1px solid}
            img{float:left;height:100px}
            </style>
            
            <h1>Decorations</h1>
            <div>
            <img src="1.gif">
            <dl>
            <dt>Acorn Bird Feeder</dt>
            <dd>Description:</dd>
            <dd>Dimensions:</dd>
            </dl>
            </div>
            
            <div>
            <img src="1.gif">
            <dl>
            <dt>Desert Clock</dt>
            <dd>Description:</dd>
            <dd>Dimensions:</dd>
            </dl>
            </div>
            Notice the markup is easier to read and edit. The styling stays out of the way in the head or can be placed in an external stylesheet.

            Inline CSS styles are evil.

            You should use margin and padding to space out your elements, not <br> which is used for line endings.

            The transitional doctype you are using is for older pages transitioning to using current html markup. New pages should never used deprecated markup and, therefore, a strict doctype. However, you are using older markup and it's needed to keep certain errors from being flagged by the validator though the browser won't care.

            If possible, it's always good to have an online test site cause it's easier than copy/pasting everything, plus we have the advantage of having any images.

            Comment

            • mariko
              New Member
              • Mar 2010
              • 23

              #7
              Will that fix my inconsistency problems concerning browsers? I agree that I need to update my code regardless. Thanks for helping me!

              Comment

              • drhowarddrfine
                Recognized Expert Expert
                • Sep 2006
                • 7434

                #8
                Generally, the only problem browser will be IE, but as long as you initially test your markup in a modern browser, everyone will fall into line and you'll have only IE to contend with.

                The purpose of doing it by the example is to eliminate all those unnecessary elements and give you more control. One single div contains one single product and that single product can be moved anywhere on the screen. Using <br> each is a little blocking element and each must be manipulated should anything change. All the extra nesting you had before is gone.

                Comment

                • drhowarddrfine
                  Recognized Expert Expert
                  • Sep 2006
                  • 7434

                  #9
                  As I said, there are other ways to do this. Some will say that's a "list of products" so:
                  <ul>
                  <li><img src=""><p>Descr iption: </p></li>
                  <li></li>
                  </ul>

                  but I think that would start to get hairy.

                  Comment

                  • MusoFreak200
                    New Member
                    • Oct 2009
                    • 96

                    #10
                    that is what i have used...

                    but i can't get it to send information through a mailto: link...

                    and no one has been able to help me

                    Comment

                    • MusoFreak200
                      New Member
                      • Oct 2009
                      • 96

                      #11
                      it is different in different broswers because each browswer reads and writes slightly differently and that is why you get some people who prefer firefox over IE7 and stuff...

                      Comment

                      Working...