SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2003
    Location
    UK
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    background color / divs

    Howdy

    I'm working on this css site : www.shuballs.tk

    The problem is, whenever you try to highlight text on the page (in a browser), it acts strangely. I'm assuming that this is because its in a <div>.

    So I took the main text out of the <div> and just added css styles to the <body>. This worked OK positionally, but obviously if I change the background color of the <body>, then the whole page will change and I will lose the white box of the main text.

    I can't for the life of me figure out a way to keep the white box, and allow the page to be highlighted/selected in a browser properly!

    Any suggestions?

    Thanks in advance.

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,471
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    It's a problem with IE as mozilla is ok with this. It's when you absolutely place an element then the text can't be highlighted properly.

    The solution (if possible) is not to place your element absolutely but use the margin property to position it. Of course this does depend on what else is going on in the page.
    Code:
    .main {
     margin-left: 140px;
     margin-top: 150px;
     width: 490px;
     background-color: #FFFFFF;
     padding: 10px;
    }
    You will probably also need to move the absolutely placed logo div down in the html to the end otherwise the top margin on your .main style will not work correctly (another bug in IE).
    Code:
    <div class="logo"></div>
    </body>
    </html>

    Paul

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2003
    Location
    UK
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats great, thanks


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
  •