SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Where does the pink background come from?

    I need assistance with a problem that I can't identify. Either I'm overlooking something really simple, or something utterly bizarre is happening.

    I'm developing a web page (attached) that's divided into two divs: a left sidebar with a fixed width and a main div that fills the rest of the window. The left div is further divided into a bottom div that resizes itself to fit its content and a top div that fills the rest of the sidebar. In the finished page, the top-left div will display a table of contents, the main div will display a page loaded from the table of contents, and the bottom-left div will display the page's URL. (For simplicity, this version fills all of the divs with fixed text.)

    It works, except that the background of the table of contents div is a garish salmon pink (rgb=xF0E0E0). I used that color in an early stage of development when I just wanted the colors to contrast.

    I've changed the main div's background to white and the URL and T.O.C. background to light grey (xF0F0F0). The main div and the URL display their new colors correctly. The T.O.C. is still pink.

    I'm developing with Chrome. When I load the page, Chrome's View Page command shows that the T.O.C. div's background color is xF0F0F0. The Developer Tools window's Elements tab assures me that the color is xF0E0E0. That tells me that the server is delivering the correct version of the page; whatever the problem is, it is lurking on the client side.

    I know what you're thinking: clear the cache. I did. It made no difference.

    I tried loading the page in Firefox. The T.O.C. background was pink there, too. Again, clearing the cache made no difference.

    I tried Internet Explorer. It displayed the T.O.C.'s background color correctly but gave me a mysterious "Object Expected" error when it tried to execute a JavaScript function that resizes the divs. I looked up the error and found many explanations, but the only relevant one was a problem with some of IE's DLLs.

    I moved the source file to another machine where it never existed before. IE executes the JavaScript function correctly there, but Chrome, Firefox, and IE all display the wrong background color.

    The source file contains no instance of the string xF0E0E0, and does not load any CSS or define any global styles. (If it did, the in-line style should override them.)

    Where is the salmon pink background coming from?
    Attached Files Attached Files

  2. #2
    SitePoint Addict
    Join Date
    Jan 2009
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post a link

  3. #3
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,060
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by ttmt View Post
    Can you post a link
    I just approved the attachment

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,060
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    The salmon pink colour is coming from line 21 (background:#ffe0e0):

    Code:
    document.getElementById('top').setAttribute('style',  "background:#ffe0e0; position:absolute; float:top; width:100%; min-height:128px; overflow-y:auto; " + 'height:'+topHeight+'px' );
    Remove that and it should revert to being gray, as per line 31 (background:#f0f0f0):

    Code:
    <div id='top' style="background:#f0f0f0; position:absolute; width:100%; padding:5px; overflow-y:auto;">
      <strong>text top</strong>
      xxxxxxx xsaasaszzzzxkjsdf sdlksdlkj ewfjcsj sdkdkj cj  jdasfolk amqwwejos xdasj23ozs sjwio
      xxxxxxx xxkjsdf sdlksdlkj ewfjcsj sdkdkj cj  jdasfolk amqwwejos xdasj23ozs sjwio
      xxxxxxx xxkjsdf sdlksdlkj ewfjcsj sdkdkj cj  jdasfolk amqwwejos xdasj23ozs sjwio
    </div>

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you! Interesting... my editor still does not find it, even though it's in plain sight. Clearly I've got another issue to resolve. :-)

  6. #6
    SitePoint Addict
    Join Date
    Jan 2009
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I opened the index.x.html file you uploaded in a text editor (TextMate ), removed the 'background:#ffe0e0;' and the pink background is gone.

    Inline css styles in the html or Javascript are always harder to fix. It would be easier to have a separate css file or at least css within <style> tags on the same page.

  7. #7
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,060
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by ttmt View Post
    Inline css styles in the html or Javascript are always harder to fix. It would be easier to have a separate css file or at least css within <style> tags on the same page.
    Agree with that.
    A clean separation of concerns is always good to aim for.

  8. #8
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My experience has been that during early development it's a lot easier to write the styles inline, then move them to styles when the design reaches a certain level of stability. Apart from the simplicity of dealing with one file instead of two, it eliminates the difficulty of thinking about the project in abstract terms before its concrete nature is clear.

    I don't think there's a right or wrong side to this. It's a matter of how an individual developer thinks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •