• CSS coding error

    Author
    Topic
    #448059

    The line of CSS below produces a CSS error but I need help to understand what is needed to correct the error that reads:

    Expected end of value but found `top’. Error in parsing value for `margin’. Declaration dropped.
    http://www.sandiwaygolf.co.uk/gallery.html%5B/url%5D

    #container {position:absolute; /*relative;*/ width:770px; height:396px; margin:20px /*auto 0 auto;*/ top:20px; left:200px; border:1px solid #aaa; background:#fff

    Thank you in anticipation,

    Viewing 0 reply threads
    Author
    Replies
    • #1094463

      Your code, when tidied up reads:

      #container {position:absolute; 
      /*relative;*/ 
      width:770px; 
      height:396px;
      margin:20px
       /*auto 0 auto;*/ 
      top:20px; 
      left:200px; 
      border:1px solid #aaa; 
      background:#fff

      The use of /* and */ is a way to comment out parts of the CSS so in fact it is just:

      #container {
      position:absolute; 
      width:770px; 
      height:396px;
      margin:20px;
      top:20px; 
      left:200px; 
      border:1px solid #aaa; 
      background:#fff;
      }
      

      You had left off the closing semi-colon and closing curly bracket

      • #1094470

        My sincere apologies – the line of code was incomplete and reads:

        #container {position:absolute; /* relative;*/ width:770px; height:396px; margin:20px /*auto 0 auto;*/ top:20px; left:200px; border:1px solid #aaa; background:#fff url(../imagestoo/back.jpg) 75px 10px no-repeat;}

        I have used the comments /* . . . */ to remind me of the original code as I had a great deal of difficulty in getting the gallery to display as expected.

        • #1094474

          I’ve found an error in that a semicolon is missing (margin:20px ). Putting it in clears the CSS error but the gallery shoots up the page to partly cover the banner. Fixing that is for tomorrow!

          • #1094477

            If you look at my revised code higher up in th thread you can see I spotted that wink grin

            Well done for spotting that, it is amazing how one little thing can skew code. I have found that laying the code out as I have assists in fault finding of this kind

    Viewing 0 reply threads
    Reply To: CSS coding error

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: